Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22233

Cant link boost library with g++ Windows

$
0
0

I'm trying to build the following code:

Content of "Source.cpp"

#include <boost/filesystem.hpp>
using namespace boost::filesystem;

int main(int argc, char* argv[])
{
   path myPath("foo");

   if (exists(myPath)) ...
}

The command that I use to compile it is:

g++ -Wall -I D:\boost_1_72_0 Source.cpp -o test -L D:\boost_1_72_0\stage\lib -lboost_filesystem-vc142-mt-gd-x32-1_72

But I get default unresolved symbol errors:

C:\Users\User\AppData\Local\Temp\ccskBqAh.o:Source.cpp:(.text$_ZN5boost10filesystem11path_traits7convertEPKcS3_RNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEE[__ZN5boost10filesystem11path_traits7convertEPKcS3_RNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEE]+0x7): undefined reference to `boost::filesystem::path::codecvt()'
... etc

There's no problem when I compile it with Visual Studio though.

P.s. Space after "-L" and "-I" is allowed. And I've tried to link different libs. For shared I also used #define BOOST_ALL_DYN_LINK just in case.

Shared:

boost_filesystem-vc142-mt-gd-x32-1_72
boost_filesystem-vc142-mt-gd-x64-1_72
boost_filesystem-vc142-mt-x32-1_72
boost_filesystem-vc142-mt-x64-1_72

Static:

libboost_filesystem-vc142-mt-gd-x32-1_72
libboost_filesystem-vc142-mt-gd-x64-1_72
libboost_filesystem-vc142-mt-sgd-x32-1_72
libboost_filesystem-vc142-mt-sgd-x64-1_72
libboost_filesystem-vc142-mt-s-x32-1_72
libboost_filesystem-vc142-mt-s-x64-1_72
libboost_filesystem-vc142-mt-x64-1_72

Viewing all articles
Browse latest Browse all 22233

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>