in my current project I´m working with the arpackpp interface. The entire library is written in .h
files, so that there is no need to compile the library. The problem I'm facing now - when I include some of the arpackpp
header files in some of my files, which are not the main.cpp
, I get the following errors:
/.../Files/Includes/../../../arpack++/include/arerror.h:163: multiple definition of
ArpackError::Set(ArpackError::ErrorCode, std::string const&)' /.../Files/Includes/../../../arpack++/include/arerror.h:163: first defined here /tmp/ccruWhMn.o: In function
std::iterator_traits::iterator_category std::__iterator_category(char* const&)': /.../Files/Includes/../../../arpack++/include/arerror.h:163: multiple definition ofArpackError::code' /.../Files/Includes/../../../arpack++/include/arerror.h:163: first defined here /tmp/ccruWhMn.o: In function
std::vector >::max_size() const':
for several arpackpp
functions when linking all the .o
files. As I have read in several threads the problem is that I actually include the instantiation of the functions, which should be normally avoided.
Because I don't want to change the whole library I included all classes and functions using arpackpp
classes in main.cpp
, which is getting quite messy. Is there a workaround to this problem? And why doesn't include guards (#ifndef...#endif)
prevent this problem?