Skip to content

Linking against a library that links against other libraries #1816

Answered by samsinsane
Epsylene asked this question in Q&A
Discussion options

You must be logged in to vote

Your Lib library doesn't contain any code - functions in headers like hello.h aren't compiled in the library but in the file that #includes them, in this case app.cpp. You need to put the contents of notmain() into hello.cpp and then export it like this:

// Windows
__declspec(dllexport) int notmain();

// Not-Windows
__attribute__((visibility("default"))) int notmain();

You can see how GLFW does it here and it is used here.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Epsylene
Comment options

Answer selected by Epsylene
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants