开发者

Compiling my Boost/NTL program with c++ on Linux

开发者 https://www.devze.com 2023-01-02 13:23 出处:网络
I wrote a client program and a server program, that uses the NTL library and Boost::Asio, to do client/server communication for an integer factorization application, in C++.

I wrote a client program and a server program, that uses the NTL library and Boost::Asio, to do client/server communication for an integer factorization application, in C++.

Both sides consist of several headers and cpp files. Both project compile fine individually on Windows in Visual Studio. All I did, was add the include path of NTL and Boost to both projects:

Additional include paths: "D:\Downloads\WinNTL-5_5_2\include";D:\boost_1_42_0

Furthermore, for both projects, I added the two library paths to both projects in VS:

Additional library directories: D:\boost_1_42_0\stage\lib;"D:\Documents\Visual Studio 2008\Projects\ntl\Debug"

And added under Additional dependencies:

ntl.lib

As said, it compiles fine on Windows. But when I put the code on a Linux machine provided by university, I try to compile with the following statement

c++ -I/appl/htopopt/Linux_x86_64/NTL-5.4.2/include -I/appl/htopopt/Linux_x86_64/boost_1_43_0/include client_protocol.cpp mpqs_client.cpp mpqs_sieve.cpp mpqs_helper.cpp -o mpqs_helper -L/appl/htopopt/Linux_x86_64/NTL-5.4.2/lib -lntl -L/appl/htopopt/Linux_x86_64/gmp-4.2.1/lib -lgmp -lm -L/appl/htopopt/Linux_x86_64/boost_1_43_0/lib -lboost_system -static

Upon doing this, I get a huuuge error, which I posted here. Any ide开发者_如何学Goa how to fix this, please??


You are getting lots of errors to do with missing pthread symbols. Try adding

-lpthread

to your link line.


I'm not sure, but I suspect you can't do multi-threading in a staticly linked binary.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号