简体   繁体   中英

xcode linker error while using class with generics

I'm getting the following error in Xcode, and after looking online for a while I could not find the solution. I am creating an object Grid which uses a generic, but I cannot initiate it without getting this error. Any help or insight would be greatly appreciated.

Ld "/Users/IQ/Library/Developer/Xcode/DerivedData/IQ_Maps-ghefraspxyhtuudxovbglequskej/Build/Products/Debug-iphonesimulator/IQ Maps.app/IQ Maps" normal i386 cd "/Users/IQ/Documents/IQ Labs/IQ Maps" setenv IPHONEOS_DEPLOYMENT_TARGET 6.0 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/IQ/Library/Developer/Xcode/DerivedData/IQ_Maps-ghefraspxyhtuudxovbglequskej/Build/Products/Debug-iphonesimulator -F/Users/IQ/Library/Developer/Xcode/DerivedData/IQ_Maps-ghefraspxyhtuudxovbglequskej/Build/Products/Debug-iphonesimulator "-F/Users/IQ/Documents/IQ Labs/IQ Maps/../../../Desktop" "-F/Users/IQ/Documents/IQ Labs/IQ Maps/. ." "-F/Users/IQ/Documents/IQ Labs/IQ Maps/../../Desktop" "-F/Users/IQ/Documents/IQ Labs/IQ Maps" -filelist "/Users/IQ/Library/Developer/Xcode/DerivedData/IQ_Maps-ghefraspxyhtuudxovbglequskej/Build/Intermediates/IQ Maps.build/Debug-iphonesimulator/IQ Maps.build/Objects-normal/i386/IQ Maps.LinkFileList" -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -stdlib=libc++ -mios-simulator-version-min=6.0 -framework opencv2 -framework AssetsLibrary -framework QuartzCore -framework CoreMedia -framework ImageIO -framework CoreVideo -framework CoreLocation -framework AVFoundation -framework CoreMotion -framework UIKit -framework Foundation -framework CoreGraphics -o "/Users/IQ/Library/Developer/Xcode/DerivedData/IQ_Maps-ghefraspxyhtuudxovbglequskej/Build/Products/Debug-iphonesimulator/IQ Maps.app/IQ Maps"

ld: warning: directory not found for option '-F/Users/IQ/Documents/IQ Labs/IQ Maps/../../Desktop' Undefined symbols for architecture i386: "Grid::Grid(int, int)", referenced from: Tracker::Tracker() in Tracker.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

It looks like library of class files are linked properly from out side of you project.

It is not able to link to that library/Class path which has mentioned in the project build settings linker section.

ld: warning: directory not found for option '-F/Users/IQ/Documents/IQ Labs/IQ Maps/../../Desktop

warning: shows that linker is not able to find location/path of lib/class at specified location.

Remmove linker path form Linker section of project build settings related to that lib/classes.

Now add again those lib or classes to your project. Make sure it should show only linker path in build setting which you have specified. Build/Run again.

I hope it will help you to resolve that issue.

Why do I get "unresolved external symbol" errors when using templates?

this was a duplicate, and I didn't even realize. Sorry about that. Thank you for your help, but the problem was with how I was using the generic/template class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM