我想使用AA+ 天文类框架,我只想让示例应用程序运行(它包含在框架 zip 文件中AATest.cpp
)
我打开 Xcode,为 C++ 应用程序创建了一个新项目,然后将AA+.h
和stdafx.h
文件添加到项目中,因为它们包含在内。然后,当我构建项目时,我收到很多链接器错误,因为它似乎无法找到与某些示例应用程序代码关联的符号。
我尝试在 Xcode 的 Build 设置中将路径AA+.h
和stdafx.h
文件添加到库和标头搜索路径,但这并没有改变任何东西,错误仍然存在。
我究竟做错了什么?这是我第一次在 Xcode 中使用 C++。我是否必须首先将 AA+ 框架构建为静态库,或者我可以以这种方式包含它吗?
通过 Xcode 编译:
Ld /Users/me/Library/Developer/Xcode/DerivedData/AAPlus-bzgonjwgqlpgescueekcoobljdyf/Build/Products/Debug/AAPlus normal x86_64
cd "/Users/me/Downloads/aaplus astronomy c++/Example/AAPlus"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/me/Library/Developer/Xcode/DerivedData/AAPlus-bzgonjwgqlpgescueekcoobljdyf/Build/Products/Debug -F/Users/me/Library/Developer/Xcode/DerivedData/AAPlus-bzgonjwgqlpgescueekcoobljdyf/Build/Products/Debug -filelist /Users/me/Library/Developer/Xcode/DerivedData/AAPlus-bzgonjwgqlpgescueekcoobljdyf/Build/Intermediates/AAPlus.build/Debug/AAPlus.build/Objects-normal/x86_64/AAPlus.LinkFileList -mmacosx-version-min=10.7 -stdlib=libc++ -o /Users/me/Library/Developer/Xcode/DerivedData/AAPlus-bzgonjwgqlpgescueekcoobljdyf/Build/Products/Debug/AAPlus
错误:
Undefined symbols for architecture x86_64:
"CAANutation::TrueObliquityOfEcliptic(double)", referenced from:
GetSolarRaDecByJulian(double, double&, double&) in main.o
GetLunarRaDecByJulian(double, double&, double&) in main.o
"CAADynamicalTime::DeltaT(double)", referenced from:
GetSolarRaDecByJulian(double, double&, double&) in main.o
"CAARiseTransitSet::Calculate(double, double, double, double, double, double, double, double, double, double)", referenced from:
GetSunRiseTransitSet(double, double, double) in main.o
GetMoonRiseTransitSet(double, double, double) in main.o
"CAAMoonIlluminatedFraction::PhaseAngle(double, double, double)", referenced from:
GetMoonIllumination(double, double&, double&, double&) in main.o
"CAAMoonIlluminatedFraction::PositionAngle(double, double, double, double)", referenced from:
GetMoonIllumination(double, double&, double&, double&) in main.o
"CAAMoonIlluminatedFraction::IlluminatedFraction(double)", referenced from:
GetMoonIllumination(double, double&, double&, double&) in main.o
"CAAMoonIlluminatedFraction::GeocentricElongation(double, double, double, double)", referenced from:
GetMoonIllumination(double, double&, double&, double&) in main.o
"CAACoordinateTransformation::Ecliptic2Equatorial(double, double, double)", referenced from:
GetSolarRaDecByJulian(double, double&, double&) in main.o
GetLunarRaDecByJulian(double, double&, double&) in main.o
"CAASun::ApparentEclipticLatitude(double)", referenced from:
GetSolarRaDecByJulian(double, double&, double&) in main.o
"CAASun::ApparentEclipticLongitude(double)", referenced from:
GetSolarRaDecByJulian(double, double&, double&) in main.o
"CAADate::CAADate(double, bool)", referenced from:
PrintTime(double, char const*) in main.o
"CAADate::CAADate(long, long, double, bool)", referenced from:
PrintSunAndMoonInfo(int, int, int, double, double) in main.o
"CAAMoon::EclipticLatitude(double)", referenced from:
GetLunarRaDecByJulian(double, double&, double&) in main.o
"CAAMoon::EclipticLongitude(double)", referenced from:
GetLunarRaDecByJulian(double, double&, double&) in main.o
"CAADate::Get(long&, long&, long&, long&, long&, double&) const", referenced from:
PrintTime(double, char const*) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)