Dear ROOTers,
(brief, skippable introduction)
I’m currently trying to combine Visual Studio (C++ CLR Empty Project (.NET Framework)) and ROOT: I need to create an analysis tool with some customizable GUI and I would like to compile it and to generate a .exe file.
It is my first time using VS, so I manage to build my first GUI, which can run with VS debugger and then I try to add as header #include <TROOT.h> and I get several errors of the following type:
- error LNK2028: unresolved token
- error LNK2001: unresolved external symbol
- error LNK2019: unresolved external symbol
Long story short, in the end I tried to generate a really basic code, just to figure out if I am able to include a generic ROOT header
#include <iostream>
#include <TROOT.h>
using namespace std;
int main() {
std::cout << "Bears. Beets. Battlestar Galactica." << std::endl;
return 0;
}
As soon as I add the line “#include <TROOT.h>” I’m getting the following outputs:
1>------ Build started: Project: TryToLoadROOT, Configuration: Debug Win32 ------
1>Source.cpp
1>C:\root_v6.22.02\include\ROOT\RWrap_libcpp_string_view.h(428,31): error C2039: ‘__find_end’: is not a member of ‘std’
1>C:\root_v6.22.02\include\ROOT\RWrap_libcpp_string_view.h(125): message : see declaration of ‘std’
1>Done building project “TryToLoadROOT.vcxproj” – FAILED.
I tried to google a bit and I found this thread. I tried to apply what’s suggested there and I get other errors:
1>------ Build started: Project: TryToLoadROOT, Configuration: Debug Win32 ------
1>Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol “public: __thiscall TVersionCheck::TVersionCheck(int)” (??0TVersionCheck@@QAE@H@Z) referenced in function “void __cdecl ROOT::Internal::`dynamic initializer for ‘gVersionCheck’'(void)” (??__EgVersionCheck@Internal@ROOT@@YAXXZ)
1>C:\Users\manaigof\source\repos\TryToLoadROOT\Debug\TryToLoadROOT.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project “TryToLoadROOT.vcxproj” – FAILED.
I also made sure that “C:\root_v6.22.02\include” is properly included in the “Additional Include Directories” of the project and that, on cmd.exe “echo %path%” gives me "C:\root_v6.22.02\bin" as one of the arguments.
This unfortunately was not enough, so I restored “RWrap_libcpp_string_view.h” as it was originally and here I am asking if anyone could, please, help me out.
Thank you so much for any feedback!
Filippo
Please read tips for efficient and successful posting and posting code
ROOT Version: v6.22.02
Platform: Windows 10
Compiler: Microsoft Visual Studio Community 2019 (Version 16.7.4)