_ROOT Version: 6.28
_Platform: Windows10, 64bit
_Compiler: Visual studio 2022
It’s a very simple test code. I set the including path, library path, lib input, environment variables. The code is built succeeded. But can not run. I copy all the *.dll files from bin folder to the built exe folder. It still can not run. Please help let me know where I’m wrong. Thank you very much!
#include <TF1.h>
int main(int argc, char** argv)
{
TF1* f1 = new TF1(“f1”, “sin(x)/x” , 0, 10);
f1->Draw();
return 0;
}
Make sure you build with the same flags than the ones used to build ROOT. Since you only have one source file, I would suggest to build in the x64 Native Tools Command Prompt for VS 2022. Something like this:
Thank you very much, Bellenot! It works!
I also find a way to build and run from Visual studio 2022 IDE. No environment variable setting required. The compiled exe file needs to be put into the Root/bin folder.