Root macro compilation errors on windows

Hi,

When I try to compile my Macro on my windows 7 installation of root, I get the following error…

[size=85][color=#0000FF]root [8] .L F:\My CodeBase\AlgoTrading\Code\Test\TestMacros\MyMacro.c+
Info in TWinNTSystem::ACLiC: creating shared library F:\My CodeBase\AlgoTrading\Code\Test\TestMacros\MyMacro_c.dll
24492696_cint.cxx
MyMacro_c_ACLiC_dict.cxx
C:\root\cint\cint\include\stddef.h(8) : error C2632: ‘int’ followed by ‘wchar_t’ is illegal
C:\root\cint\cint\include\stddef.h(8) : warning C4091: 'typedef ’ : ignored on left of ‘unsigned int’ when no variable is declared
C:\root\cint\cint\include\stdio.h(4) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdio.h(11) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdio.h(12) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdio.h(32) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdlib.h(4) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdlib.h(11) : error C2632: ‘int’ followed by ‘wchar_t’ is illegal
C:\root\cint\cint\include\stdlib.h(11) : warning C4091: 'typedef ’ : ignored on left of ‘unsigned int’ when no variable is declared
C:\root\cint\cint\include\stdlib.h(12) : warning C4068: unknown pragma
C:\root\cint\cint\include\math.h(6) : warning C4068: unknown pragma
C:\root\cint\cint\include\limits.h(14) : fatal error C1017: invalid integer constant expression
Error in : Compilation failed!
root [9][/color][/size]

The errors point to statements of the form, “typedef unsigned int wchar_t;” .
If I comment out the offending statements in stddef.h and stdlib.h files and try compiling again, I get the following error.

[size=85][color=#0000FF]root [9] .L F:\My CodeBase\AlgoTrading\Code\Test\TestMacros\MyMacro.c+
Info in TWinNTSystem::ACLiC: creating shared library F:\My CodeBase\AlgoTrading\Code\Test\TestMacros\MyMacro_c.dll
2272450_cint.cxx
MyMacro_c_ACLiC_dict.cxx
C:\root\cint\cint\include\stdio.h(4) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdio.h(11) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdio.h(12) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdio.h(32) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdlib.h(4) : warning C4068: unknown pragma
C:\root\cint\cint\include\stdlib.h(12) : warning C4068: unknown pragma
C:\root\cint\cint\include\math.h(6) : warning C4068: unknown pragma
C:\root\cint\cint\include\limits.h(14) : fatal error C1017: invalid integer constant expression
Error in : Compilation failed!
root [10][/color][/size]

My include path looks like this
root [10] .include
include path: -IC:\root/include -IC:\root\cint\cint\include

How can I correct this?
Cheers
Arindam

Could you post mymacro.c? From the error it is almost as if “unsigned” had been #define’d to be nothing! Also, just on the off chance, did you match the version of visual studio and the ROOT build? A copy of the macro file, however, is what will let someone like Philippe answer this question right away.

Pretty much anything on the lines of the code down below…

[size=85]#include
#include
#include
#include <stdlib.h>

void myMacro()
{}[/size]

Runs fine in the interpreted mode though…

If you do just "#include " and leave off the others will it work?

Just tried… nope… same set of errors :frowning:
Also verified the root/VC++ versions… seem correct as per the docs

Hi,
Sorry to take so long to get back to you.

So, your include path is different from mine:

C:\Users\gwatts\Desktop>root -l root [0] .include include path: -IC:\root/include -I../../include root [1]

So, if I set my include path to be your include path (using gSystem->SetIncludePath) then I get exactly your errors. So the question is: why is cint in your include path - it shouldn’t be (at least, according to my install). One thing I don’t know how to do: clear out your include path. It seems some items in the include path are hardwired.

Can you tell me exactly what version of root you downloaded? Depending on the answer I’ll get in touch with the author of ACLiC to help out with this configuration problem.

I have a very annoying habbit of reading email about once (or maybe) twice a day. The only way I can get things done these days! I appologize for making you wait so long!

Cheers,
Gordon.

Hi Gordon,

The reason i included “C:\root\cint\cint\include” in the include path is that when i dont, i get complaints about stddef.h being missing. And the only place i find stddef in root is C:\root\cint\cint\include.

[color=#0000FF][size=85]root [0] .L C:\Arindam\Temp\MyMacro.c+
Info in TWinNTSystem::ACLiC: creating shared library C:\Arindam\Temp\MyMacro_c.dll
23496265_cint.cxx
MyMacro_c_ACLiC_dict.cxx
c:\arindam\temp\MyMacro_c_ACLiC_dict.h(10) : fatal error C1083: Cannot open include file: ‘stddef.h’: No such file or directory
Error in : Compilation failed!

root [1] .include
include path: -IC:\root/include[/size][/color]

I downloaded the debug MSI file for the version that goes with VC++ 9.

Thanks.

Arindam

Hi Arindam,

In the context of ACLiC, this file should be coming from the compiler’s include directory and not from CINT itself. This leads me to believe that in the terminal window that was used to start ROOT the Microsoft compiler was not properly setup (eg. Did you run vcvars32.bat or something like that?)

Philippe.

Hi,

Yeah I ran [color=#0000BF][size=85]C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat[/size][/color]

My PATH on windows looks like this,

[color=#000080][size=85]C:\root\bin;C:\Program Files\Microsoft Visual Studio 9.0\VC\bin;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE[/size][/color]

The stddef.h that I find in the VC installation is here

[size=85][color=#000080]C:\Program Files\Microsoft Visual Studio 9.0\VC\include[/color][/size]

But if I add this to the root include path, all hell breaks loose… loads of errors then…

Cheers

Arindam

Hi,

Do not add the directory to the include path by hand :slight_smile: It should not be needed and will fail (as you saw).

What is the output of:gDebug = 7; .L F:\My CodeBase\AlgoTrading\Code\Test\TestMacros\MyMacro.c++
Also you may want to try using the extension .cxx for your script.

Cheers,
Philippe.

Hi,
Ah, yes! You should not need to add any include paths by hand to any compiler files.

I’ve had the most success by just runnign the Visual Studio Command Prompt that you can find from the start menu, and then cd’ing to the directory where my files are and running root from there.

Another thing to watch out for is making sure no where (and NO WHERE in caps here) is there a space in your path. So your work area path can not have spaces. They’ve never protected rootcint or the internals of ROOT against spaces. And all heck will break loose when you do that.

Cheers,
Gordon.

i did a combo of renaming the file to .cxx and running root from inside the VS command prompt… that did it… Thanks a ton for your help

-Arindam

[quote=“arin_ray”]i did a combo of renaming the file to .cxx and running root from inside the VS command prompt… that did it… Thanks a ton for your help

-Arindam[/quote]

Fantastic. Glad it is working. I’m a little surprised you had to change the file type. I’ve been using cpp and cxx and I don’t think I’ve noticed anything. And I’m pretty sure I’ve used .C for some basic macros.

Yeah, I dont think that was necessary, I tried later with a C file and that worked as well… The main thing to do was to start root from inside the VS command prompt…