开发者

when you create C++ shared library do you need to attach only headers of what your lib would depend?

开发者 https://www.devze.com 2023-02-19 17:11 出处:网络
So I create a library. I want to use shared ffmpeg libs. On mac os with xcode. I create project file with premake4. Shall I connectsha开发者_运维知识库red libs to my project or shall I only connect in

So I create a library. I want to use shared ffmpeg libs. On mac os with xcode. I create project file with premake4. Shall I connectsha开发者_运维知识库red libs to my project or shall I only connect includes?


If I understand your question correctly, you're asking if you need both the shared libraries and the headers, or just the headers, for your project to work.

You need both. The libraries are generally were the actual code for the functions and classes declared in the headers lives. Your project will compile just fine with only the headers present, but unless there is corresponding code in a lib or shared lib, you can count on linker errors.

I have to say I'm not familiar with the actual build process on OS X, but I believe the above is inherent to any C/C++ project regardless of OS.

Also, since you're probably working with the Standard Library you might have the impression that all you're doing is #includeing headers (iostream, stdio.h, etc), but the libraries are still there and have been added by default by your IDE.

0

精彩评论

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

关注公众号