x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Linker error with C++ std lib on Linux

I am trying to include a library of my own functions in my Unreal project. I can successfully link the library dynamically, however attempting to use any functions which utilise std::string and other parts of the standard library cause a linker error ( undefined reference). Linking statically causes a similar error, regardless of whether the functions are used or not.

The library is built with Qt Creator (no Qt libraries though), and is linked against libstdc++ (tested with both clang and g++).

As far as I can tell, Unreal is trying to use the packaged libc++ instead of libstdc++. Searching online suggests setting a variable called UE4_LINUX_USE_LIBCXX to 0 somewhere, but I cannot find any details on how to do this.

Is this the correct approach to be taking, and if so, how/where do I set this variable?

Product Version: UE 4.16
Tags:
more ▼

asked Jun 21 '17 at 05:49 AM in Linux

avatar image

JoshNewans
1 1 1 2

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

The best approaches to take (in order of preference):

  1. rebuild your library to use libc++

  2. add a dependency on libstdc++ to your module (PublicAdditionalLibraries.Add("stdc++"))

  3. set the environment variable UE4_LINUX_USE_LIBCXX to 0 and recompile Unreal.

Rationale: if you're planning to redistribute the resulting Unreal project across Linux distros, you may run into problems with compatibility of libstdc++.so. You cannot bundle libstdc++.so with your Unreal project or link it statically (at least without consulting the lawyer), so you are better off using libc++ which can be freely bundled.

more ▼

answered Jul 18 '17 at 06:07 PM

avatar image

RCL STAFF
2.7k 59 6 88

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question