I am trying to compile the a program in Linux and the program contains the following header files:
#include <iostream>
#include <vector>
#include "Minuit2/FCNBase.h"
#include "FunctionMinimum.h"
#include "MnMigrad.h"
etc. The source file is in
home/christian/code
and the header files are all in
/home/christian/root/include/Minuit2
I am trying to compile by running the following command:
g++ -I /Minuit2 niminimzationExample.cpp -o niminimzationExample -L/Minuit2/lib -lMinuit2
But I get the following error message:
In file included from niminimzationExample.cpp:9:0:
/home/christian/root/include/Minuit2/FCNBase.h:13:10: fatal error: Minuit2/MnConfig.h: No such file or directory
#include "Minuit2/MnConfig.h"
Because the compiler cannot find MnConfig.h which is the first header file inside of FCNBase.h. I have also tried to run
g++ -I /home/christian/root/include/Minuit2 niminimzationExample.cpp -o niminimzationExample -L/Minuit2/lib -lMinuit2
But I still get the same error. What is the write way to include the header files?
Thanks.
If your header is at
/home/christian/root/include/Minuit2/FCNBase.h
Your #include
or compile option is wrong.
Currently you are telling the compiler to search for
/Minuit2/Minuit2/FCNBase.h
or
/home/christian/root/include/Minuit2/Minuit2/FCNBase.h
You should specify an option
-I /home/christian/root/include
To have the compiler search for Minuit2/FCNBase.h
in the directory /home/christian/root/include
.
If you don't want to change the option, you should change the #include
to
#include "FCNBase.h"
To have the compiler search for FCNBase.h
in the directory /home/christian/root/include/Minuit2
.