开发者

gsoap - compile using -lcrypt

I am working in ubuntu under c++ code. I am using gsoap in order to connect to a server. I've obtained all the data necesarry. I've also succeeded to connect to the server. Still I do have a question. Why do I need to write in the command line: g++ test_serve开发者_StackOverflowr.cpp -o testServ libgsoap++.a. Why do I need to include libgsoap++.a in my command line if I did include all the dependencies in my folder? EDIT:

If I don't include libgsoap++.a in the command line i have:

undefined reference to `soap_embed'
/tmp/ccyeN0df.o: In function `soap_serialize_string(soap*, char* const*)':
TEST.cpp:(.text+0xb9de): undefined reference to `soap_reference'
/tmp/ccyeN0df.o: In function `soap_out_string(soap*, char const*, int, char* const*, char const*)':
TEST.cpp:(.text+0xba15): undefined reference to `soap_outstring'
/tmp/ccyeN0df.o: In function `soap_in_string(soap*, char const*, char**, char const*)':


You need to tell g++ that you want to link against libgsoap++ using -lgsoap++.

If you want to link against non-system-wide version of libgsopa++, you need to specify library path to g++ via -L flag.

Short explanation:

You have link-time error. The compilation was successful and produced object files. During compilation time, you "promised" (by including gsoap include files) that soap_serialize_string et al exist somewhere, and object code is available.

Now linker tries to make an executable from that object files. It checks all that "promises" in object files and tries to resolve it: replace it with invoking actual functions. Where do this "actual functions" exist? In your case, it is libgsoap++.a.

So if you don't tell linker to link against libgsoap++.a, promises just remain promises, and you have undefined references.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜