开发者

C++(GCC). Library curl. Statically linked

What options set, to statically linked the library curl ?

Library should be integrated to executable file.

tried different: added options g++ -DCURL_STATICLIB -lcurl 开发者_JAVA百科... added #define CURL_STATICLIB to the code ..., in the IDE NetBeans added libcurl.a, libcurldll.a ... etc.,

Compile is successful and all works great. But still require external libcurl.dll! (Size of executable file also increases!)

What's wrong ? might have something add to the IDE (also used NetBeans, Eclipse)

Please show a correct example as you would make

Executable file should be without calling an external dll library

it my first question :)


Fix.

Example compile for library curl with OpenSSL + zlib + libidn + libssh2 + librtmp:

g++ -static main.cpp -lcurl -lidn -lwldap32 -lssh2 -lz -lrtmp -lssl -lssl32 -lcrypto -lgdi32 -lws2_32 -lwinmm -o test.exe

note: here shouldn't be specified -lcurldll. This will lead to that: compile is successful, but still require external libcurl.dll


you need to specify -static in the linker options

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜