在跟随test case example之后,我坚持制作。
我的程序如下。
~/Qt/5.12.2/clang_64/bin/qmake -project "QT +=testlib"
=>它生成了Testcase.pro
~/Qt/5.12.2/clang_64/bin/qmake
=>生成文件
~/Qt/5.12.2/clang_64/bin/moc -o testqstring.moc testqstring.h
=> testqstring.moc已生成
make
=> moc_predefs.h和moc_testqstring.cpp生成,并且打印错误如下。
❯ make
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.12 -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/Users/sungyong/Qt/5.12.2/clang_64/lib -o Testcase.app/Contents/MacOS/Testcase testqstring.o moc_testqstring.o -F/Users/sungyong/Qt/5.12.2/clang_64/lib -framework QtGui -framework QtTest -framework Security -framework Foundation -framework ApplicationServices -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
duplicate symbol __ZN11TestQString18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZN11TestQString11qt_metacallEN11QMetaObject4CallEiPPv in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZNK11TestQString10metaObjectEv in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZTV11TestQString in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZTS11TestQString in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZTI11TestQString in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZN11TestQString11qt_metacastEPKc in:
testqstring.o
moc_testqstring.o
duplicate symbol __ZN11TestQString16staticMetaObjectE in:
testqstring.o
moc_testqstring.o
ld: 8 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Testcase.app/Contents/MacOS/Testcase] Error 1
我错了什么?