Disclaimer: I'm aware of questions like this and this but nothing helped me to solve my problem.
I'm trying do compile a larger project dependent on ROOT package, and I was able to reproduce the error I'm facing in minimal example:
test.cpp:
#include "Math/GenVector/GenVector_exception.h"
int main()
{
ROOT::Math::GenVector::Throw("foo");
}
compiled with: g++ -lGenVector test.cpp
gives:
/tmp/ccq9A45m.o: In function `main':
test.cpp:(.text+0xc): undefined reference to `ROOT::Math::GenVector::Throw(char const*)'
collect2: error: ld returned 1 exit status
localizing libGenVector.so with ld --verbose -lGenVector | grep "lib GenVector.so succeeded"
gives:
attempt to open //usr/local/lib/libGenVector.so succeeded
checking if symbol is defined in library with
nm -DgC --defined-only /usr/local/lib/libGenVector.so| grep Throw
gives:
000000000003f180 T ROOT::Math::Throw(ROOT::Math::GenVector_exception&)
000000000003f1e0 T ROOT::Math::GenVector::Throw(char const*)
Basing on answer to this question, I also tried to compile with -std=c++11
and -std=c++14
and -std=c++17
but everything gives the same error message.