简体   繁体   中英

How to compile .c .h .so file?

Another company gives me three files(demo.c,api.h,libapi.so). they told me that't enough for develop. I'm confuse how to build these thing together. I use gcc demo.c -o demo -l libapi.so . But's it's said "ld: library not found". I use Mac OS system. Some websites said i should use Linux to use .so file. what should I do?

*.so is "shared object" it works only on Linux. The Windows counterpart of *.so is DLL.These are combiled object code.

What you have to do is 1] "compile" your .c to .o [object file] 2] "Link" the new .o file with the .so

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM