[Windows] c file compiling

Goodevening, I still have problems to compile the file.
I putted the cors_plot.c in the directory

I opened root and I wrote the command

but it doesn’t compile (see the screenshot for the error), can somebody help me please? Maybe the error is because I wrote

and not `, but I’ve an italian keyboard and I don’t have the `. Here on internet or in a text editor I can write the ` using the command ALT+96 but in root software this command downs’t work…can somebody help me please?

Change the “subject” of this thread so that is explicitly contains “Windows 10 Dev c++” words. Then someone, who is familiar with it, will notice it (maybe Bertrand, I don’t use Windows).
All I can say is that you need to add ROOT specific “–cflags” to your compiler line and then also ROOT specific “–ldflags” and “–glibs” to your linker line.

[quote=“Pepe Le Pew”]
All I can say is that you need to add ROOT specific “–cflags” to your compiler line and then also ROOT specific “–ldflags” and “–glibs” to your linker line.[/quote]
Hi pepe and thanks…can you me explain what do you mean please?

I’ve got a better idea … see:

hi pepe, I don’t know if I understood what you mean…
I wrote on prompt of windows:

but I’ve errors (see screenshots)

ps. in italian[quote] “nmake non è riconosciuto come comando interno o esterno, un programma eseguibile o un file batch”[/quote] means that "nmake is not recognized as an internal or external command, as an executable software or a batch file

Hi pepe, thanks

  1. I putted the cors_plot.c in the subdirectory c:/root_v5.34.36/macros
  2. I opened visual studio command prompt 2010 and I digited vcvarsall.bat, and I think it worked because i read [quote]Setting enviroment for using Microsoft Visual 2010 x86 tools[/quote]
    3)I entered in bin subdirectory of root directory c:/root_v5.34.36/bin

and untill now no problem
4) I digited the command thisroot.bat but it doesn’t open ROOT
5) I tried to open root digiting root so it opened ROOT
6) I digited .L cors_plot.c
but it write noething, so I dont’ know if it works, because I need the data files and I still don’t have them (they are in the CNAF servers and I’m waiting for the access)…

but now I was thinking

My thesis superadvisors gave me a some instructions and there is written:

so maybe i must not use my ROOT but I must use the ROOT installed on CNAF servers (and I think CNAF servers use Linux)…do you think it is right?


1) setting up the link to ROOT (bash shell)

source /opt/exp_software/lhaaso/root/bin/thisroot.sh

2) compiling the software

root-config --cxx --cflags -fbounds-check -o cors_plot cors_plot.c root-config --glibs -lMinuit

3) running the software

./cors_plot < flie.list[/code]
Step “1)” on Windows is executing “thisroot.bat” (note: it will NOT start ROOT, it will set some system variables which are needed).
I don’t know how step “2)” should look line on Windows (you need to find someone who uses Windows).

Hi pepe and thanks…so i must use my root and not root of cnaf…well…

I have
a) cors_plot.c, it is a software to read CORSIKA files and save them in ROOT
b) CorsiLHAA-300001-0001-00-00-01000000.outu files (the CORSIKA files)
c) file-gamma.list
the original code of this file was

300000 '_total_number_of_showers_' 1 '_total_number_of_files___' '/data.n/NAMETEACHERATCNAF/CorsiLHAA-300001-0001-00-00-01000000.outu' because my teacher has the files .outu on CNAF servers. I have a copy of the .outu

now I did:

  1. putting the cors_plot.c file is in macros subdirectory of root
    2)putting the CorsiLHAA-300001-0001-00-00-01000000.outu in macros subdirectory
  2. changing the code of the file-gamma.list from 300000 '_total_number_of_showers_' 1 '_total_number_of_files___' '/data.n/NAMETEACHERATCNAF/CorsiLHAA-300001-0001-00-00-01000000.outu' to

300000 '_total_number_of_showers_' 1 '_total_number_of_files___' '/CorsiLHAA-300001-0001-00-00-01000000.outu'
4)putting the file-gamma.list in macros subdirectory
5) opnening visual studio
6) digiting vcvarsall.bat
7)digiting thisroot.bat
8 )digiting root to open root
9) digiting .L cors_plot.c
10) digiting ./cors_plot.c <file-gamma.list
but when i digit the last code (n°10) I have the errors of the screenshot

Goodevening, my teacher sayed me that I must compile cors_plot.c using a compiler and not using ROOT … First time I compiled using Dev c++, but it doesn’t work so I thinked to use ROOT…does somebody know a good compiler for windows?

You can try to rename your “cors_plot.c” into “main.cxx” and then execute:
root -l -n -q main.cxx++ < file-gamma.list

hi pepe, I sent you a personal message

I’ve sent you a modified source code in a private message.

Hi pepe, thanks, I saw your modified code, but, unfortunatly I have some errors…

I gave you the full command line which includes the root call (so you should not execute “root” and try it from inside).
With ROOT 5, you can also try it another way:
root [0] .x cors_plot.cxx < file-gamma.list
root [0] .x cors_plot.cxx++ < file-gamma.list

I update the situation compiling the file cors_plot.c using Dev c++


Goodmorning everybody! I have a problem with a root file. M thesis superadvisor gave me a root file written in c++. The file works because he compiled the file on his computer (apple mac). Now I’m trying to compile it on my computer (windows 10 using Dev c++) but I have problems.

First error (I resolved it): The file was a .c source, when I compiled the source I had this error:

on this row

#include <iostream>

but I resolved it saving the file as a .cpp source

Second error (I resolved it)::Dev c++ could’nt find the TFile.h, TTree.h etc file, but I resoled it copying all the header files from root directory to dev c++ directory

Third error (I can’t resolve it):: Now when I try to compile the file I’ve the errors download/file.php?id=12175&mode=view

Today I resolved linking the headers files of root in dev c++ (I had to make a new project, add the cors_plot.cpp in the project menu, in the options of the project, in the card parameters, there is a culomn called “Linker” and in this culomn I linked all the header of ROOT, but when I compile, I’ve the error of the screenshot…In the log there aren’t errors or warnings, but it doesn’t compile. I add the file

////////////////TO PEPE LE PEW ///////////////////////////////////////

[quote=“Pepe Le Pew”]I gave you the full command line which includes the root call (so you should not execute “root” and try it from inside).

Hi pepe, I tried 2 times( download/file.php?id=12190&mode=view), first time I didn’t write “root”, second time I didn’t, but I had the same problems

[quote=“Pepe Le Pew”]With ROOT 5, you can also try it another way:
root [0] .x cors_plot.cxx < file-gamma.list
root [0] .x cors_plot.cxx++ < file-gamma.list[/quote]

Now I tried this too…but writing

.x cors_plot.cxx < file-gamma.list

I have this error i66.tinypic.com/2hd3bya.png

and writing

.x cors_plot.cxx++ < file-gamma.list

this error
cors_plot.c (49.4 KB)

In both cases, you first started the “root” executable and then you tried my “full command line” in the “root [0]” prompt, which is wrong. You should execute my “full command line” without starting the “root” executable first (i.e. directly in the terminal prompt).
BTW. Maybe the ROOT executable on Windows is called “root.exe” instead of “root” (if yes, then you should use “root.exe -l -n -q cors_plot.cxx < file-gamma.list”).

Hi pepe, I wrote this in the prompt

root.exe -l -n -q cors_plot.cxx < file-gamma.list

it worked but there is a problem, after few seconds it stopped, so it selected just few events (8 events)…


You can simply compile it from a Visual Studio command prompt with the following commands (after renaming the file cors_plot.cpp). For release (optimized) mode:

For debug mode:

This will produce a cors_plot.exe application
N.B. You have to use the same configuration (debug/release) than ROOT itself.

Cheers, Bertrand.

Hi bellenote, thank but unfortuntaly it doesn’t work…i have an error (see attachment)…
Do you know the reason?

PS. In the command for linux/mac I know my teacher used Minuit, but I don’t have Minuit, do you think thi is the reason?