Undefined reference to `TVersionCheck::TVersionCheck(int)

Hello!

I want to use root libs in my Qt program.
But I have problems with linker: undefined reference to `TVersionCheck::TVersionCheck(int)
I don’t know what is the reason.
I do read different forum, but still can’t understand my error.
Please, help me.

My .pro file

QT += core
QT -= gui

CONFIG += c++11

TARGET = v_root_trees_2
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

INCLUDEPATH += "C:/root_v5.34.34/include"

LIBS += -L"C:/root_v5.34.34/lib"  \
-lcomplexDict \
-ldequeDict \
-lfreetype \
-llibAfterImage \
-llibASImage \
-llibASImageGui \
-llibCint \
-llibCintex \
-llibCore \
-llibEG \
-llibEGPythia8 \
-llibEve \
-llibFitPanel \
-llibFoam \
-llibFTGL \
-llibFumili \
-llibGdml \
-llibGed \
-llibGenetic \
-llibGenVector \
-llibGeom \
-llibGeomBuilder \
-llibGeomPainter \
-llibGLEW \
-llibGpad \
-llibGraf \
-llibGraf3d \
-llibGui \
-llibGuiBld \
-llibGuiHtml \
-llibGviz3d \
-llibHist \
-llibHistPainter \
-llibHtml \
-llibMathCore \
-llibMathMore \
-llibMatrix \
-llibMinuit \
-llibMinuit2 \
-llibMLP \
-llibNet \
-llibPhysics \
-llibPostscript \
-llibProof \
-llibProofDraw \
-llibProofPlayer \
-llibPyROOT \
-llibQuadp \
-llibRecorder \
-llibReflex \
-llibReflexDict \
-llibRGL \
-llibRHTTP \
-llibRint \
-llibRIO \
-llibRODBC \
-llibRooFit \
-llibRooFitCore \
-llibRooStats \
-llibRootAuth \
-llibSessionViewer \
-llibSmatrix \
-llibSpectrum \
-llibSpectrumPainter \
-llibSPlot \
-llibSQLIO \
-llibTable \
-llibThread \
-llibTMVA \
-llibTree \
-llibTreePlayer \
-llibTreeViewer \
-llibUnuran \
-llibVMC \
-llibWin32gdk \
-llibXMLIO \
-llistDict \
-lmap2Dict \
-lmapDict \
-lmathtext \
-lmultimap2Dict \
-lmultimapDict \
-lmultisetDict \
-lsetDict \
-lvectorDict

main.cpp file:

#include <QCoreApplication>

#include "TMultiGraph.h" // problem if add this line

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    return a.exec();
}

I don’t know what is wrong.
I added all .lib files.
The paths “C:/root_v5.34.34/lib” and “C:/root_v5.34.34/include” are correct and do exist.
If I change paths I will see “cannot find …” error.
So, my paths are true.

Thank you in advance.
Best regards, Vladislav.

I checked the similar code in VS2013 - I don’t see any errors.
But I write a lot of code in Qt and can’t change my IDE.
I understand, that I made link error, but can’t find it.

Hi,

Could you try to change the link order (e,g, put -llibCore -llibCint first)?
EDIT:

So which version of Visual Studio are you using (the one which is failing)?

Cheers, Bertrand

It doesn’t work.

I have an error in QtCreator 3.6.0 ( build on Qt 5.5.1(MSVC 2013, 32 bit) ). Compiler is MinGW 4.9.2 32 bit.

I don’t have any errors in Microsoft Visual Studio Community 2013( Version 12.0.31101.00 Update 4 ).
.NET Framework Version 4.6.01055

I also asked this question on stackoverflow.com/questions/3717 … oncheckint , but their advice doesn’t work too.

Hi Vladislav,

[quote=“Vladislav”]I have an error in QtCreator 3.6.0 ( build on Qt 5.5.1(MSVC 2013, 32 bit) ). Compiler is MinGW 4.9.2 32 bit.

I don’t have any errors in Microsoft Visual Studio Community 2013( Version 12.0.31101.00 Update 4 ).
.NET Framework Version 4.6.01055

[/quote]
OK, thanks. Then may I ask why you want to use MingW? (which is unsupported…)
Why not using Visual Studio?

Cheers, Bertrand.

I have this same exact issue. If anyone has found a solution, please share it.

Thanks so much.

Chris

Hi Chris,

If using consistent library from the same version of ROOT, simply linking against the libCore should be sufficient to resolve this problem.

Cheers,
Philippe.

Okay, so in Qt, I right clicked the project, went to Add Library, went to add External Library, selected the libcore as the library file and C:\root_v5.34.36\include was populated into the include path field. Then I tried both Dynamic and Static linkage.

I get an error of LNK1104: cannot open file ‘C:\root_v5.34.36\lib.obj’

I have tried to comment out everywhere where there is root related things in my project and it still produces this error. The header files are even commented out.

I also tried making a new project, and then copying everything from the old.

I don’t know why I am getting this error. Please help.

Thanks so much.

Chris

Hello!

I has similar problem with linker again.
In previous case error happened because I used root cern compiled in Visual Studio, but compiled my program in MinGW compiler. When I started to compile my program using VS compiler this error disappeared.

About current case.
My system: Scientific Linux release 7.2 (Nitrogen).
My gcc: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4).
I downloaded root_v6.06.08.Linux-slc6-x86_64-gcc4.8.tar.gz file.
Then I typed the next commands in terminal:

tar zxvf root_v6.06.08.source.tar.gz
cd root-6.06.08/
./configure
make

As a result I got this confirmarion:

"   ============================================================
   ===                ROOT BUILD SUCCESSFUL.                ===
   === Run 'source bin/thisroot.[c]sh' before starting ROOT ===
   ============================================================
"

Then:

cd bin
source thisroot.sh

I launched root and typed .demo. All work very well.
So, I installed root cern correctly.

Then I tried to compile simple project in QtCreator.
About QtCreator: Qt Creator 4.0.2 Based on Qt 5.7.0 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit).
I downloaded this framework from qt.io/download-open-source/

When I added a root lib I got an error.
Code for .pro file:

QT += core
QT -= gui

CONFIG += c++11

TARGET = Test_lib_links
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

INCLUDEPATH += "/home/darkside/Vlad_Programs/root-6.06.08/include"

LIBS += -L"/home/darkside/Vlad_Programs/root-6.06.08/lib" \
-lCore \
-lCling \
-lASImage \
-lASImageGui \
-lASImageGui \
-lcomplexDict \
-ldequeDict \
-lEG \
-lEve \
-lFitPanel \
-lFoam \
-lforward_listDict \
-lFTGL \
-lFumili \
-lGed \
-lGenetic \
-lGenVector \
-lGeomBuilder \
-lGeomPainter \
-lGeom \
-lGLEW \
-lGpad \
-lGraf3d \
-lGraf \
-lGuiBld \
-lGuiHtml \
-lGui \
-lGviz3d \
-lGX11 \
-lGX11TTF \
-lHbook \
-lHistPainter \
-lHist \
-lHtml \
-llistDict \
-lmap2Dict \
-lmapDict \
-lMathCore \
-lMatrix \
-lMemStat \
-lMinuit \
-lMLP \
-lmultimap2Dict \
-lmultimapDict \
-lMultiProc \
-lmultisetDict \
-lNet \
-lNew \
-lPhysics \
-lPostscript \
-lProofBench \
-lProofDraw \
-lProofPlayer \
-lProof \
-lQuadp \
-lRecorder \
-lRGL \
-lRint \
-lRIO \
-lRootAuth \
-lSessionViewer \
-lsetDict \
-lSmatrix \
-lSpectrumPainter \
-lSpectrum \
-lSPlot \
-lSQLIO \
-lSrvAuth \
-lThread \
-lTMVAGui \
-lTMVA \
-lTreePlayer \
-lTree \
-lTreeViewer \
-lunordered_mapDict \
-lunordered_multimapDict \
-lunordered_multisetDict \
-lunordered_setDict \
-lvalarrayDict \
-lvectorDict \
-lVMC \
-lX3d \
-lXMLIO

.cpp file:

#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{

    cout << endl << "all is ok" << endl;
    return 0;
}

I have this run-time error:

Error in <UnknownClass::InitInterpreter()>: LLVM SYMBOLS ARE EXPOSED TO CLING! This will cause problems; please hide them or dlopen() them after the call to TROOT::InitInterpreter()!
Fatal in <operator delete>: storage area overwritten
aborting
#0  0x00007f05a208cb0c in waitpid () from /lib64/libc.so.6
#1  0x00007f05a2011092 in do_system () from /lib64/libc.so.6
#2  0x00007f05b43a2cd9 in TUnixSystem::StackTrace() () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#3  0x00007f05b4318151 in DefaultErrorHandler(int, bool, char const*, char const*) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#4  0x00007f05b4317bca in ErrorHandler () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#5  0x00007f05b4318002 in Fatal(char const*, char const*, ...) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#6  0x00007f05a9145140 in operator delete(void*) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libNew.so
#7  0x00007f05b25815d6 in clang::driver::toolchains::Linux::Linux(clang::driver::Driver const&, llvm::Triple const&, llvm::opt::ArgList const&) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#8  0x00007f05b25583a1 in clang::driver::Driver::getToolChain(llvm::opt::ArgList const&, llvm::StringRef) const () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#9  0x00007f05b2560593 in clang::driver::Driver::BuildCompilation(llvm::ArrayRef<char const*>) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#10 0x00007f05b2354de6 in (anonymous namespace)::createCIImpl(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, int, char const* const*, char const*, bool) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#11 0x00007f05b235781b in cling::CIFactory::createCI(llvm::StringRef, int, char const* const*, char const*) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#12 0x00007f05b23d9db5 in cling::IncrementalParser::IncrementalParser(cling::Interpreter*, int, char const* const*, char const*) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#13 0x00007f05b23311c8 in cling::Interpreter::Interpreter(int, char const* const*, char const*, bool) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#14 0x00007f05b22c3225 in TCling::TCling(char const*, char const*) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#15 0x00007f05b22c449e in CreateInterpreter () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCling.so
#16 0x00007f05b42ed3b8 in TROOT::InitInterpreter() () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#17 0x00007f05b42ed736 in ROOT::Internal::GetROOT2() () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#18 0x00007f05a9145175 in operator delete(void*) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libNew.so
#19 0x00007f05b434cf2e in TClassTable::Add(char const*, short, std::type_info const&, TClass* (*)(), int) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#20 0x00007f05b4362b46 in ROOT::TGenericClassInfo::TGenericClassInfo(char const*, int, char const*, int, ROOT::Internal::TInitBehavior const*, TClass* (*)(), int) () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#21 0x00007f05b42c1588 in TMath::ROOT::GenerateInitInstance() () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#22 0x00007f05b425872c in _GLOBAL__sub_I_G__Core.cxx () from /home/darkside/Vlad_Programs/root-6.06.08/lib/libCore.so
#23 0x00007f05b471f3a3 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2
#24 0x00007f05b471146a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#25 0x0000000000000001 in ?? ()
#26 0x00007ffe94bb8911 in ?? ()
#27 0x0000000000000000 in ?? ()
Press <RETURN> to close this window...

Could you help?

Thank you in advance.
Best regard, Vladislav.

Hi Vladislav,

This is a different problem:

Unfortunately this is a bug in libmesa that was reported as a bug to the freedesktop people: bugs.freedesktop.org/show_bug.cgi?id=93103

This was apparently fixed in some recent-ish version of their software, see the bug report.

As they exposed llvm to the whole process it’s basically impossible to hide them from libCling and ling’s symbol resolution; there will be a clash if they don’t keep them local to their libs (as they do now).

One solution is to not link against that library (disabling OpenGL in both ROOT and Qt).

Cheers,
Philippe.

Many thank for your help.

Sorry, I am not big specialist in linux.
Should I delete root cern and run the next commands?

./configure --disable-opengl
make

Can I solve this problem if I install the other previous version of root cern?

Yes.

Cheers,
Philippe.

Hi,

I had this issue. In order to resolve it, I removed some existing root libs that existed elsewhere on my system, and I reordered my gcc command line arguments. I suspect the second behavior is what fixed it. What I did was I moved the sourcefile to the start of the list.

Did not work: g++ $$(root-config --libs) $$(root-config --cflags) --std=c++14 -ggdb -O0 infile.C -o outfile
Did work: g++ infile.C $(root-config --libs) $(root-config --cflags) --std=c++14 -ggdb -O0 -o outfile

I also removed all other root installations from my system.

2 Likes