I'm trying to compile some linux code which uses freeglut on OS X. I have installed freeglut using homebrew but am now getting a bunch of warnings about having both gl.h and gl3.h, but more worryingly, I'm getting this linker error:
Undefined symbols for architecture x86_64:
"_glutMainLoopEvent", referenced from:
main::$_1::operator()() const in main.cpp.o
ld: symbol(s) not found for architecture x86_64
Here is the command-line compiler command I used:
FAILED: : && /Library/Developer/CommandLineTools/usr/bin/c++
-Wl,-search_paths_first -Wl,-headerpad_max_install_names prog/CMakeFiles/prog.dir/main.cpp.o -o prog/prog
lib/display/libdisplay.a -framework AGL -framework OpenGL -framework
GLUT -framework Cocoa lib/training/libtraining.a lib/core/libcore.a
lib/utility/libutility.a -lpthread
/usr/local/lib/libboost_log-mt.dylib
/usr/local/lib/libboost_thread-mt.dylib
/usr/local/lib/libboost_system-mt.dylib
/usr/local/lib/libboost_filesystem-mt.dylib
/usr/local/lib/libboost_unit_test_framework-mt.dylib
/usr/local/lib/libboost_program_options-mt.dylib && :
What am I doing wrong?
Related
I am trying to add freeglut to my program but I didn't find any way to do that. In MacOs to add glut library and glu i had to compile from terminal with :
g++-9 -framework GLUT -framework OpenGL
My purpose was to add freeglut in order to use glutLeaveMainLoop() in my program.
So I added the Library but i get this error:
Undefined symbols for architecture x86_64:
"_glutLeaveMainLoop"
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
I had the same errors when I tried compiling my program without adding -framework OpenGL -framework GLUT
Is it possible to compile with g++ using also freeglut ?
Since MacOs doesn't have a freeglut library itself, after downloading the library with brew, I solved the problem myself by adding the -L and the -l :
g++-9 -framework GLUT -framework OpenGL -L /usr/local/Cellar/freeglut/3.0.0/lib -lglut file.cpp
I am trying to implement openssl code I found into my project but I get these linker errors that aren't going away. I checked that the frameworks are properly linked and even included the library and header search paths manually using ../lib and ../include. Despite this the error goes away when I get rid of the Openssl function or any function calls such as EVP_OpenUpdate or EVP_OpenInit. This only if I create and then call the function from my ViewController.h file for some reason.
Here is the log of the error:
Ld /Users/User/Library/Developer/Xcode/DerivedData/LineaSSL-clrggexngizkqqbtcxpnmsciuwag/Build/Products/Debug-iphoneos/LineaSSL.app/LineaSSL normal armv7
cd /Users/User/Documents/LineaSSL
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs
/iPhoneOS5.1.sdk -L/Users/User/Library/Developer/Xcode/DerivedData/LineaSSL-clrggexngizkqqbtcxpnmsciuwag/Build/Products/Debug-iphoneos -L/Users/User/Documents/LineaSSL/../../Desktop/x2on-OpenSSL-for-iPhone-a095890/OpenSSL-for-iOS/lib -L/Users/User/Documents/LineaSSL/../../Downloads/DTDevices-iOS_2012-06-15_v1/Library -L/Users/User/Documents/LineaSSL/OpenSSL-for-iOS/lib -L/Users/User/Documents/LineaSSL/lib -F/Users/User/Library/Developer/Xcode/DerivedData/LineaSSL-clrggexngizkqqbtcxpnmsciuwag/Build/Products/Debug-iphoneos -Finclude -Finclude/openssl -filelist /Users/User/Library/Developer/Xcode/DerivedData/LineaSSL-clrggexngizkqqbtcxpnmsciuwag/Build/Intermediates/LineaSSL.build/Debug-iphoneos/LineaSSL.build/Objects-normal/armv7/LineaSSL.LinkFileList -dead_strip -miphoneos-version-min=4.0 -lcrypto -lssl -framework CoreGraphics -framework ExternalAccessory -framework Foundation -framework UIKit -ldtdev -o /Users/User/Library/Developer/Xcode/DerivedData/LineaSSL-clrggexngizkqqbtcxpnmsciuwag/Build/Products/Debug-iphoneos/LineaSSL.app/LineaSSL
ld: warning: ignoring file /Users/User/Desktop/x2on-OpenSSL-for-iPhone-a095890/OpenSSL-for-iOS/lib/libcrypto.a, file was built for archive which is not the architecture being linked (armv7)
ld: warning: ignoring file /Users/User/Desktop/x2on-OpenSSL-for-iPhone-a095890/OpenSSL-for-iOS/lib/libssl.a, file was built for archive which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7:
"_rsa_open3", referenced from:
-[ViewController barcodeData:isotype:] in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please let me know what I should do in regards to this error.
Thanks in advance.
I had to rebuild the entire project from scratch in order to get it to work. I don't know why I had to do such a thing though.
I know that this question had been asked many times, but every answer seems different. I have built my project and tried to run it, but I get this error:
Ld "/Users/******/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Products/Debug-iphonesimulator/Cypher Bot.app/Cypher Bot" normal i386
cd "/Users/******/Xcode/iOS/Cypher Bot/Universal/Cypher Bot/Cypher Bot"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/********/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Products/Debug-iphonesimulator -F/Users/**********/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Products/Debug-iphonesimulator -filelist "/Users/*******/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Intermediates/Cypher Bot.build/Debug-iphonesimulator/Cypher Bot.build/Objects-normal/i386/Cypher Bot.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework Security -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -o "/Users/********/Library/Developer/Xcode/DerivedData/Cypher_Bot-dxylepzskcnrtybprtuaotmycjjo/Build/Products/Debug-iphonesimulator/Cypher Bot.app/Cypher Bot"
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
objc-class-ref in CryptoMainViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also get this right below the message above:
What does this mean? What do I do to fix it?
The error means that the linker can't find the class definition for MFMailComposeViewController. That class is defined in the MessageUI framework. Did you add the MessageUI framework to your target? If you don't know how to do that, read this: How to "add existing frameworks" in Xcode 4?
I have purchased reddle kit for ipad pdf viewer. when i try to run the demo program i am getting following error
Ld /Users/svp/Library/Developer/Xcode/DerivedData/RDPDFKitSample-gjablgzmrirtqteckhbcytapkwcc/Build/Products/Debug-iphonesimulator/RDPDFKitSample.app/RDPDFKitSample normal i386
cd /Users/svp/Desktop/RDPDFKitDemo_1_2
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/svp/Library/Developer/Xcode/DerivedData/RDPDFKitSample-gjablgzmrirtqteckhbcytapkwcc/Build/Products/Debug-iphonesimulator -L/Users/svp/Desktop/RDPDFKitDemo_1_2/RDPDFKit.embeddedframework/RDPDFKit.framework/Versions/A -F/Users/svp/Library/Developer/Xcode/DerivedData/RDPDFKitSample-gjablgzmrirtqteckhbcytapkwcc/Build/Products/Debug-iphonesimulator -F/Users/svp/Desktop/RDPDFKitDemo_1_2/RDPDFKit.embeddedframework -filelist /Users/svp/Library/Developer/Xcode/DerivedData/RDPDFKitSample-gjablgzmrirtqteckhbcytapkwcc/Build/Intermediates/RDPDFKitSample.build/Debug-iphonesimulator/RDPDFKitSample.build/Objects-normal/i386/RDPDFKitSample.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework SystemConfiguration -framework RDPDFKit -framework Security -framework OpenGLES -framework QuartzCore -lz -framework CoreText -framework MessageUI -weak_framework UIKit -weak_framework Foundation -framework CoreGraphics -o /Users/svp/Library/Developer/Xcode/DerivedData/RDPDFKitSample-gjablgzmrirtqteckhbcytapkwcc/Build/Products/Debug-iphonesimulator/RDPDFKitSample.app/RDPDFKitSample
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_NSFileCoordinator", referenced from:
objc-class-ref in RDPDFKit(libRDPDFKit.a-i386-master.o)
"_OBJC_CLASS_$_UIReferenceLibraryViewController", referenced from:
objc-class-ref in RDPDFKit(libRDPDFKit.a-i386-master.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
how can i solve this issue.
We don't support building with iOS 4 SDK.
Make sure you are building with iOS 5 SDK. YOur application will still be able to run on device with iOS 4.0.
Danil Somsikov
Readdle Inc.
When i try to compile my project for the simulator or real devices, i get these errors:
Ld /Users/maumau/Library/Developer/Xcode/DerivedData/HarvestMoon-bciczopagtmfyqgxjxasrffzrnls/Build/Products/Debug-iphoneos/HarvestMoon.app/HarvestMoon normal armv7
cd /Users/maumau/Dropbox/Daten/Projekte/HMiOS
setenv IPHONEOS_DEPLOYMENT_TARGET 4.3
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/maumau/Library/Developer/Xcode/DerivedData/HarvestMoon-bciczopagtmfyqgxjxasrffzrnls/Build/Products/Debug-iphoneos -L/Users/maumau/Dropbox/Daten/Projekte/HMiOS/../../../../Library/Developer/Xcode/DerivedData/HarvestMoon-bciczopagtmfyqgxjxasrffzrnls/Build/Products/Debug-iphoneos -F/Users/maumau/Library/Developer/Xcode/DerivedData/HarvestMoon-bciczopagtmfyqgxjxasrffzrnls/Build/Products/Debug-iphoneos -filelist /Users/maumau/Library/Developer/Xcode/DerivedData/HarvestMoon-bciczopagtmfyqgxjxasrffzrnls/Build/Intermediates/HarvestMoon.build/Debug-iphoneos/HarvestMoon.build/Objects-normal/armv7/HarvestMoon.LinkFileList -dead_strip -ObjC -framework Foundation -framework UIKit -miphoneos-version-min=4.3 /Users/maumau/Library/Developer/Xcode/DerivedData/HarvestMoon-bciczopagtmfyqgxjxasrffzrnls/Build/Products/Debug-iphoneos/libbox2d.a -framework QuartzCore -framework OpenGLES -framework OpenAL -framework AudioToolbox -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/maumau/Library/Developer/Xcode/DerivedData/HarvestMoon-bciczopagtmfyqgxjxasrffzrnls/Build/Products/Debug-iphoneos/HarvestMoon.app/HarvestMoon
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_CCRepeatForever", referenced from:
objc-class-ref in KBPlayer.o
"_OBJC_METACLASS_$_CCTMXTiledMap", referenced from:
_OBJC_METACLASS_$_KBTMXTiledMap in KBTMXTiledMap.o
"_OBJC_CLASS_$_CCDirector", referenced from:
.... more errors ....
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
i use Xcode 4.2 and cocos2d-1.0. does anyone have an idea, how i can fix this?
You'd better to make sure that your project includes cocos2d source code or cocos2d static library. If you are using cocos2d static library, it must be compiled for armv7.
Your project is based on cocos2d application template?