This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
I m试图汇编一些C++文档。 在连接阶段时发现以下类型的错误。 (汇编工作) -
Main.o: In function operator<<(std::basic_ostream<char, std::char_traits<char> >&,
Set const&) :
/usr/include/c++/4.3/new:105: multiple definition of
operator<<(std::basic_ostream<
char, std::char_traits >&, Set const&)
bundleXX.o:/xxx/DATASTRUCTURES/SET/set.h:162: first defined h
ere
Main.o: In function print(std::basic_string<char, std::char_traits<char>, std::allo
cator<char> >, int) :
/xxx/misc.h:28: multiple definition of
print(std::basic_string, std::allocator >, int)
bundleXX.o:/xxx/misc.h:28: first defined here
该代码以前正确链接。 只是在我试图将这一守则与一些其他穿透的法典相连接的时候。
My makefile is this :-
Makefile
SRC = Main.C Bundle.C bundleXX.C BMinQuad.C MinQuad.C QPBundle.C
OBJ = Main.o Bundle.o MinQuad.o BMinQuad.o QPBundle.o bundleXX.o general_includes.o
CCC = g++
EXE = main
OPT = -O3 -fomit-frame-pointer -fno-strict-aliasing
DEBUG = -g -DDEBUG
IFLAGS = -I /xxx/ -I /xxx/DATASTRUCTURES/HEAP/ -I /xxx/DATASTRUCTURES/
LFLAGS = -lm
Main.o: $(SRC)
$(CCC) $(DEBUG) $(LFLAGS) -I /xxx/ -I /xxx/DATASTRUCTURES/ -c $(SRC)
main: $(OBJ)
$(CCC) $(OBJ) -I /xxx/ -I /xxx/DATASTRUCTURES/ -o $(EXE)
/bin/rm -rf main.o
clean:
/bin/rm -rf main.o
/bin/rm -rf $(EXE)
touch out.out
/bin/rm -rf *.out
我非常赞赏一些帮助。
增 编
Edit: I tried inlining but it didn t work. I finally minimized the number of times I was including my code in the new code and it finally linked correctly. I think it might have been a case of recursive includes. 增 编 for the help though.