'How can i link an external function to another static library?
I am programming two static libraries with extern functions in C++.
In my first library I have this line of code:
EntryPoint.hpp:
extern Application* createApplication();
In my second library i want to define this function.
WindowEntryPoint.cpp:
extern Application* createApplication() {
...
}
In my test project I want to link both libraries. That causes a linker error:
EntryPoint.cpp:(.text+0x19): undefined reference to `createApplication()'
collect2: error: ld returned 1 exit status
but when I implement this function in my test executable project, it works! In other words, after implementing this function in my second static library, I get this linker error!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|