I am using the Pelles C IDE and for certain projects have to tell the linker to include a certain library e.g. Ws2_32.lib
. Currently I am developing a function I plant to reuse frequently throughout numerous projects, so I decided to make a header file for it. Is there a way to tell the linker to include a certain library from the header file ?
我正在使用Pelles C IDE,并且某些项目必须告诉链接器包含某个库,例如WS2_32.LIB。目前我正在开发一个我在多个项目中频繁重用的函数,所以我决定为它创建一个头文件。有没有办法告诉链接器包含头文件中的某个库?
1 个解决方案
#1
0
You have link the library, no other way.
你有链接库,没有别的办法。
If compiler is gcc in linux, you can link the lirary libtemp.so
like gcc youfile.c -ltemp
And before running the executable add the path of libtemp.so
to LD_LIBRARY_PATH
如果编译器是linux中的gcc,你可以链接lirary libtemp.so像gcc youfile.c -ltemp在运行可执行文件之前将libtemp.so的路径添加到LD_LIBRARY_PATH
In your IDE you can config the samething.
在IDE中,您可以配置相同的内容。
#1
0
You have link the library, no other way.
你有链接库,没有别的办法。
If compiler is gcc in linux, you can link the lirary libtemp.so
like gcc youfile.c -ltemp
And before running the executable add the path of libtemp.so
to LD_LIBRARY_PATH
如果编译器是linux中的gcc,你可以链接lirary libtemp.so像gcc youfile.c -ltemp在运行可执行文件之前将libtemp.so的路径添加到LD_LIBRARY_PATH
In your IDE you can config the samething.
在IDE中,您可以配置相同的内容。