Rella
Rella

Reputation: 66945

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

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 connectshared libs to my project or shall I only connect includes?

Upvotes: 0

Views: 183

Answers (1)

dandan78
dandan78

Reputation: 13864

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.

Upvotes: 3

Related Questions