Embed ROOT in wxwidget application using Code::Blocks on Windows 10

Dear all,
I am implementing an application in C++ using wxwidgets. I use Code::blocks 17.12 on Win10.
I would like to integrate in my application some code using roof function to perform data plotting, fit, etc.
For this reason, I downloaded root_v5.34.38.

I have some problems in embedding the rood functionalities in the program.
I have a folder containing root inside my application directory and in the code I refer to the libraries in the
root/include/ directory.

if I include one of the root libraries such as #include "TROOT.h" I get the following error related to the TVersionCheck function.

[…]root_v5.34.38/root/include/TVersionCheck.h:34: undefined reference to TVersionCheck::TVersionCheck(int)' obj\Debug\DataStream.o: [...]root_v5.34.38/root/include/TVersionCheck.h:34: more undefined references to TVersionCheck::TVersionCheck(int)’ follow
collect2.exe: error: ld returned 1 exit status

I have inserted root_v5.34.38\root\include in the: Project build option>Search directories>compiler

I trided to open root and use the interpreter to run some files .C and it works fine. Also, if I call root from my application using wxExecute, I am able to open it and run macros. However, I would like to avoid to run root everytime and embed the root functionalities in my application in order to simplify also the data transfer between functions.

I am quite knew with root and wxwidget, Could you please help me?

Thanks a lot!


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

That doesn’t include any library, you simply include a header file. You then have to link against libCore.lib (at least)

dear Bertrand,
Thanks for your answer.
Sorry, my message was probably misunderstanding. I included the header in my c++ and in the
build option>Linker settings I inserted “root\lib\libCore.lib”. In addition, I have also tried to include other .lib file in the linker options. However, if I include the TROOT.h or any other heather, I get that error.
The root I downloaded is the v5 compiled with vs 2013.

And you are using VS 2013 to build your application?

No, currently (without adding root) I am using GCC. This because I started some time ago building this application with this compiler.
After writing the first message I noted that probably I was a bit naive because I did not pay attention on this detail. So, I tried to use VS 2017, but I have other errors and I think that it is not easily portable. :frowning:

Is it there a version compiled with GCC? Or, could you instruct me on how to do it?

Thanks a lot for your help.

Sorry, but we only build (and support) native builds with Visual Studio, up to VS2013 for ROOT 5 and with VS2019 for ROOT 6.
And as you probably guessed, you cannot mix binaries built with different versions of Visual Studio

BTW, which gcc are you using?

Dear Bertrand,
I am using the mingw32.

Do you think it is possible to build root source code with it?


I don’t think so, but you can try…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.