0
정의되지 않은 참조를 이해할 수 없습니다.cxxtest를 실행할 때 정의되지 않은 참조 오류가 발생합니다.
./cxxtest/cxxtestgen.py -o tests.cpp --error-printer DrawTestSuite.h
g++ -I./cxxtest/ -c tests.cpp
g++ -o tests tests.o Color.o
tests.o: In function `DrawTestSuite::testLinewidthOne()':
tests.cpp:(.text._ZN13DrawTestSuite16t… undefined reference to `Linewidth::Linewidth(double)'
tests.cpp:(.text._ZN13DrawTestSuite16t… undefined reference to `Linewidth::draw(std::basic_ostream<char… std::char_traits<char> >&)'
collect2: ld returned 1 exit status
make: *** [tests] Error 1// DrawTestSuite.h
DrawTestSuite.h은 단위 테스트를 포함하고, 시험 함수는 constructer 부재 함수 추첨을 실행하도록 촉구 Linewidth.h.
나는 DrawTestSuite.h에 #include "Linewidth.h"
을 가지고 있습니다.
+1. 세번째 줄은'g ++ -o tests tests.o Color.o Linewidth.o' –
@Draco : 실행중인 명령어를 보여주는 make이며 makefile을 생성 할 수 있습니다. (그렇지 않은 경우 단순히 적절한 "tests : Linewidth.o"규칙을 포함 시켜서 "Linewidth.o"를 종속성으로 추가합니다.) –
나는 그것이 makefile이라는 것을 알고 있습니다. :) –