Reputation: 2315
I am trying to run a Qt project that depends upon boost filesystem library.
Qt version: 5.6
Mac OSX 10.12
Xcode version: 8.0
Boost: 1.54
When I try to build the project, I get the following error,
"typeinfo for std::codecvt<wchar_t, char, __mbstate_t>", referenced from:
typeinfo for boost::filesystem::detail::utf8_codecvt_facet in libboost_filesystem-mt.a(utf8_codecvt_facet.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've looked at many threads on stack overflow (1, 2, 3), but none of them seem to solve my issue.
My .pro file has the following statements
macx:INCLUDEPATH += ../../boost_1_54_0
macx:LIBPATH += ../../boost_1_54_0
macx:LIBS += -lboost_filesystem-mt -lboost_system-mt -larchive -lz
[I have static files of boost-filesystem, boost-system, lib archive, libz in the build directory]
How do I solve this issue?
Upvotes: 2
Views: 697
Reputation: 94574
It sounds like you're building with a mix of libc++
and libstdc++
. At a guess you need to compile your product with the flag -stdlib=stdc++
.
Although I would advise changing your entire compile path to just use the default stdlib (
libc++
), to avoid just this situation
libstdc++
has the following:
$ nm /usr/lib/libstdc++.6.0.9.dylib | c++filt | grep 'std::codecvt<wchar_t, char, __mbstate_t>' | grep typeinfo
0000000000051710 S typeinfo for std::codecvt<wchar_t, char, __mbstate_t>
000000000004b760 S typeinfo name for std::codecvt<wchar_t, char, __mbstate_t>
while libc++
has the following:
$ nm /usr/lib/libc++.dylib | c++filt | grep '::codecvt<wchar_t' | grep typeinfo
0000000000057ff0 S typeinfo for std::__1::codecvt<wchar_t, char, __mbstate_t>
0000000000052070 S typeinfo name for std::__1::codecvt<wchar_t, char, __mbstate_t>
Note the intervening ::__1::
which is designed to prevent libc++
and libstdc++
interactions from breaking your app silently.
Upvotes: 4