Closed Exicweirdo closed 12 months ago
You shall "implement the core library only once. In your example, you included it twice, hence the multiple definition issue.
So simply remove the first line #define PL_IMPLEMENTATION 1
of your file add.cpp
.
The second issue is that you shall enable the library at runtime, by default it does nothing (not to be intrusive). The USE_PL compilation flag is a compile time disabling, and you set it ok. Your main function shall look like:
int main() {
// This call starts the profiling library in "connection mode". It requires the viewer to be launched beforehand.
// To write rather in a file (to be imported later in the viewer), add a second argument `PL_MODE_STORE_IN_FILE`
plInitAndStart("My test program");
add(1, 2);
std::cout << "Hello, World!" << std::endl;
// This call is not mandatory, but it is cleaner
plStopAndUninit();
return 0;
}
Thanks a lot!
For some project with c++ its always necessary to compile different part separately. However, the single-header lib seems to result in multiple definition in this case.
Take this minimum project as an example
main.cpp
add.cpp
Then compile it with
It fails and return
have i misunderstood sth? how to avoid this issue if i want to use palanteer?