Using VS Code for root


ROOT Version: 6.14.02
Platform: Windows 10


Hi,
I have some difficulties trying to run a root macro from visual studio. Here is the sample code:

#include <iostream>
#include <TLorentzVector.h>


using namespace std;
int main() {
    cout << "Hello World!" << endl;
    TLorentzVector v1(1.0,2.0,3.0,40);
    for (int i =0; i<4;i++){
    cout << v1[i] << " ";
    }
    return 0;
}

This is the output.

[Running] cd "c:\Users\Debajyoti Sengupta\Desktop\Codes\C++ practice\vs\practice\practice\" && g++ main.cpp -o main && "c:\Users\Debajyoti Sengupta\Desktop\Codes\C++ practice\vs\practice\practice\"main
main.cpp:2:28: fatal error: TLorentzVector.h: No such file or directory
 #include <TLorentzVector.h>
                            ^
compilation terminated.

This is my include settings

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\rootv61402\\include",
                "C:\\rootv61402\\lib"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.17134.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.15.26726/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++11",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

Anybody know what the issue is here?
Also could you recommend editors for writing root macros?

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