1

I am trying to install the hep-mc library listed here: https://github.com/cschwan/hep-mc for use on compute using the instructions listed in the documentation here: https://github.com/cschwan/hep-mc#installation . To compile one of the example files, I typed this into the terminal:

g++ -L/usr/local/hep-mc/include vegas_mpi_ex.cpp -o vegas_mpi 

but I get these error messages:

mpi_vegas_ex.cpp:1:22: error: hep/mc.hpp: No such file or directory mpi_vegas_ex.cpp:2:26: error: hep/mc-mpi.hpp: No such file or directory mpi_vegas_ex.cpp:8:17: error: mpi.h: No such file or directory 

in the beginning of my code, the declarations are like this:

#include "hep/mc.hpp" #include "hep/mc-mpi.hpp" #include <mpi.h> 

The tutorial states that I should point the compiler to the location of the "include" folder that contains all the .hpp files, which I have done. Do you guys have any idea as to what I'm doing wrong?

It should also be noted that the compiler cannot find the mpi.h directory even though I have loaded the openmpi module.

2 Answers 2

5

-L sets paths where the linker searches for libraries to link. The option you're looking for is -I, which sets the paths where the compiler searches for #included files.

Sign up to request clarification or add additional context in comments.

2 Comments

An -L option might also be needed, if this isn't a header-only library
@MattMcNabb And/or -l, true.
2
g++ -L/usr/local/hep-mc/include vegas_mpi_ex.cpp -o vegas_mpi 

Oops!

g++ -I/usr/local/hep-mc/include vegas_mpi_ex.cpp -o vegas_mpi 

-L specifies the path to library files; -I specifies the path to includes.

This is confusing because in terms of project management and distribution, we consider "the library" to include both binaries and header files, as well as documentation and all sorts of goodies. But at a technical level that is not what "library" means.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.