Hi,
I have a root 6.13.02 build from source on Ubuntu 17.10 (64bit).
I’m trying to compile an application using root libraries, but I’m getting undefined libraries error:
g++ $(root-config --cflags) $(root-config --libs --ldflags) test.C -o test
/tmp/ccqYc4Hn.o: In function `main':
test.C:(.text+0x33): undefined reference to `TString::TString(char const*)'
test.C:(.text+0x64): undefined reference to `TString::~TString()'
test.C:(.text+0x86): undefined reference to `TString::~TString()'
collect2: error: ld returned 1 exit status
The code itself is a simple test declaration of basic root TString:
#include <stdio.h>
#include "TString.h"
int main(){
printf("Hello, world!\n");
TString str = "Root string";
printf("%s", str.Data());
return 0;
}
If I try to compile it from inside root it works normally:
root [0] .L test.C++
Info in <TUnixSystem::ACLiC>: creating shared library /home/beliy/tests/./test_C.so
root [1] main()
Hello, world!
Root string(int) 0
root [2]
When I try at lxplus, it compiles, so the problem is in my installation.
I have both ROOTSYS and and LD_LIBRARY_PATH set up by thisisroot.sh script. Is there a some variable to set up, or something else that I’m missing?
Thanks in advance