B
bajichuan
Hello! I have the world's strangest linking error, and I'm hoping that
someone can help me sort it out. I recently installed and compiled a
library called LinBox without a problem. I have an object-oriented
software application, and I want it to call the library. When I add
the following 3 lines (copied directly from the library tutorial),
#include <linbox/field/modular.h>
using namespace LinBox;
typedef Modular<short> Field;
to a .cpp file, my code compiles perfectly. However, when I add the
same 3 lines to a .h file (where they *must* ultimately go), I get
(among others) the following error:
/tmp/cckvjpY5.o: In function `~edge':/usr/include/gmp.h:1590: multiple
definition of
`LinBox::ModularBase<Integer>::write(std::basic_ostream<char,
std::char_traits<char> >&) const'
Comments? This is incredibly strange to me. It looks like some sort of
linking error. Namespace conflict? I don't have root access on the
school machines, and so I have compiled and am pointing to a local
copy of the LinBox library. This is so strange... why does the code
work from
the .cpp file but not the .h file?
I hope this is an error in my code and not in the library itself.
Thoughts and suggestions on how to track this down would be carefully
considered and gratefully appreciated!
Very best regards,
Susan
PS> Here is a copy of my very simple make file:
grob_heur: gc_heur.cpp Graph.cpp MonExpEnum.cpp SetCombEnum.cpp
GraphLinearSyste
m.cpp
g++ -Wall -g \
-I/LINBOX_PATH/linbox-1.1.3/include \
-I/usr/include \
-o gc_heur gc_heur.cpp \
Graph.cpp MonExpEnum.cpp SetCombEnum.cpp GraphLinearSystem.cpp
\
/LINBOX_PATH/linbox-1.1.3/linbox/util/gmp++/.libs/libgmpxx.a \
/usr/lib/libgmp.a \
/LINBOX_PATH/linbox-1.1.3/lib/liblinbox.a
someone can help me sort it out. I recently installed and compiled a
library called LinBox without a problem. I have an object-oriented
software application, and I want it to call the library. When I add
the following 3 lines (copied directly from the library tutorial),
#include <linbox/field/modular.h>
using namespace LinBox;
typedef Modular<short> Field;
to a .cpp file, my code compiles perfectly. However, when I add the
same 3 lines to a .h file (where they *must* ultimately go), I get
(among others) the following error:
/tmp/cckvjpY5.o: In function `~edge':/usr/include/gmp.h:1590: multiple
definition of
`LinBox::ModularBase<Integer>::write(std::basic_ostream<char,
std::char_traits<char> >&) const'
Comments? This is incredibly strange to me. It looks like some sort of
linking error. Namespace conflict? I don't have root access on the
school machines, and so I have compiled and am pointing to a local
copy of the LinBox library. This is so strange... why does the code
work from
the .cpp file but not the .h file?
I hope this is an error in my code and not in the library itself.
Thoughts and suggestions on how to track this down would be carefully
considered and gratefully appreciated!
Very best regards,
Susan
PS> Here is a copy of my very simple make file:
grob_heur: gc_heur.cpp Graph.cpp MonExpEnum.cpp SetCombEnum.cpp
GraphLinearSyste
m.cpp
g++ -Wall -g \
-I/LINBOX_PATH/linbox-1.1.3/include \
-I/usr/include \
-o gc_heur gc_heur.cpp \
Graph.cpp MonExpEnum.cpp SetCombEnum.cpp GraphLinearSystem.cpp
\
/LINBOX_PATH/linbox-1.1.3/linbox/util/gmp++/.libs/libgmpxx.a \
/usr/lib/libgmp.a \
/LINBOX_PATH/linbox-1.1.3/lib/liblinbox.a