开发者

Adding a library to C

开发者 https://www.devze.com 2023-03-02 07:43 出处:网络
I\'m working with python, but I have a basic understanding of packaging with C. However I don\'t know how to build the c \'path.\' Also, my google searches seem to be failing me returning results on c

I'm working with python, but I have a basic understanding of packaging with C. However I don't know how to build the c 'path.' Also, my google searches seem to be failing me returning results on c++. Or is that my solution?

The objective is to include qrencode.h, I can surly put it in the same folder but I'd like to know how to link to it instead.

Thanks!

PS. As always, addition to read material that i开发者_StackOverflow中文版s relevant would be much appreciated!


You use an include directive to include the *.h file in your C/C++ code:

#include "qrencode.h"

As @Ignacio Vazquez-Abrams says, though, that's just a header, which declares functions; you need the actual functions, and they'll be in a *.dylib or *.so file, which needs to be linked into an executable. Compiling is turning one *.c file into a *.o file; linking is when you put all the *.o files and libraries together into an application. The -L option on the linker command line tells it where to look for libraries; the -l option tells it to include a library.

0

精彩评论

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