SDL in XCode 4.3.2 SDLMain.o undefined symbols - xcode

I have started trying to use SDL in Xcode 4.3.2 so I started up a Cocoa application for Mac OS X and connected all my frameworks : OpenGL, SDL etc. I don't have SDL_Image, SDL_Mixer etc. (Do I need these?) When I try to compile the project that just has SDLmain.h and SDLmain.m I get this error:
Undefined symbols for architecture x86_64: "_SDL_main", referenced from: -[SDLMain applicationDidFinishLaunching:] in SDLMain.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I was having the same issue with SDL 1.2.15 on Xcode 4.5 and OS X 10.7, turned out the problem was that I added SDLMain.m and SDLMain.h (according to a suggestion on the libSDL website about OS X frameworks) to an existing SDL project which messed up with main. Bottom line is that you don't need those files just because you are using Cocoa -- SDL's own test apps don't use it either and run just fine on OS X.

Related

Switched Firebase Crashlytics from CocoaPods to Swift Package now Simulator won't build on a M1 Mac

Just removed Crashlytics from the podfile, then added it as a Swift Package. Built for an actual device just fine. But when I switch to the Simulator, no go (and tried deleting Derived folders etc - no change).
Another dev using Xcode 13.2.1 on an Intel Mac can build for the Simulator just fine.
Doesn't matter if I delete DerivedFolder then build first for Simulaor or for device - when I get to Simulator it always fails same errors.
The Excluded Architectures for everything are arm64, Build Active Architure=YES
Xcode 13.4.1
Mac: Monterey 13.4
ld: warning: ignoring file .../Build/Products/Debugging-iphonesimulator/FirebaseCrashlytics.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
... (12 others)
ld: warning: ignoring file .../Build/Products/Debugging-iphonesimulator/FirebaseInstallations.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FIRCrashlytics", referenced from:
objc-class-ref in <SomeFile>-8e51ce451b9a03f7582a9e76a8faf6a6.o
objc-class-ref in <SomeFile>-e71967da3e8b662633c9220e635ffc51.o
"_OBJC_CLASS_$_FIRApp", referenced from:
objc-class-ref in SSLog-8e51ce451b9a03f7582a9e76a8faf6a6.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I posted to Firebase Issues but this issue didn't ring a bell. However, I did trip on an Apple TN on M1 Mac build issues, and doing what they suggested revolved the issue.
It appears that when Xcode builds Packages the rules it follows may not use the target's build settings. I believe the issue was related to Excluded Architectures.
For me the issue was fixed by making sure Xcode was running in Rosetta mode.

What files do i need to link to my xcode project (built in gamemaker) to make it work?

I have seen similar issues on here which has led me to believe i need to link binary files with library. However, i cannot figure out which ones i need, can any one help me with this ? I have macOS catalina 10.15.3, xcode 10.3, gamemaker 2.2.5.481 and runtime v2.2.5.378
here is my error message:
Undefined symbols for architecture x86_64:
"___isPlatformVersionAtLeast", referenced from:
UpdateIOSControllers() in libyoyo_interpreted.a(IOSGamepad.o)
_SetHomeIndicatorDeferOption in libyoyo_interpreted.a(RunnerViewController.o)
-[RunnerViewController viewDidLoad] in libyoyo_interpreted.a(RunnerViewController.o)
Achievement_TeamPlayerID() in libyoyo_interpreted.a(YoYo_GameCenter.o)
Achievement_GamePlayerID() in libyoyo_interpreted.a(YoYo_GameCenter.o)
PB_Challenges(HTTP_REQ_CONTEXT*, void*, int*) in libyoyo_interpreted.a(YoYo_GameCenter.o)
PB_PlayerPic(HTTP_REQ_CONTEXT*, void*, int*) in libyoyo_interpreted.a(YoYo_GameCenter.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Bluetooth gamepad support is added in iOS 13, which requires XCode 11 to work; you probably only need to upgrade xcode.
Reference:
https://forums.developer.apple.com/thread/123003

my first mac os x program, build error. (xcode 6.2, object-c helloworld.m)

ld: warning: ObjC object file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/CoreService.framework/CoreService) was compiled for iOS Simulator, but linking for MacOSX
ld: framework not found CoreImage for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've encountered the same problem. At last I downgrade to xcode 6.1

Qt Creator: Undefined symbols for architecture x86_64

I have a program in Qt creator that compiles and runs fine in a Windows machine. But as soon as I tried to compile it in a Mac OS X (10.9) I received these messages:
Undefined symbols for architecture x86_64:
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
std::__1::enable_if<__is_forward_iterator<char*>::value, void>::type std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init<char*>(char*, char*) in libVolumeSelectorLib.a(NetCDFDataSource.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [UI.app/Contents/MacOS/UI] Error 1
14:38:02: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project VVSIT (kit: Desktop Qt 5.4.0 clang 64bit)
When executing step "Make"
I have tried cleaning and compiling again in case some file built on Windows had made it to the Mac, but that is not the case, the problem continues happening.
I've checked these posts but their solutions didn't work:
Undefined symbols for architecture x86_64 in QT-creator
https://stackoverflow.com/questions/23806544/undefined-symbols-for-architecture-x86-64-in-qt-creator
Any idea how to solve this error?
After some research I found this thread: Qt5.1/Qt5.2 + XCode 5.0.2 + Mac OS 10.9 (Mavericks), Can’t link to the libraries
That link contains the solution that worked for me, I had to edit the file:
/Applications/Qt/5.4/clang_64/mkspecs/macx-clang/qmake.conf
And change the line that says:
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
to:
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
After that, I cleaned every subproject in my project, and compiled them again, and all is working fine now.
In case you wonder what does that change in the clang++ do, what it does is to change the parameter -mmacosx-version-min=10.7 to -mmacosx-version-min=10.9.

Cryptic link error. Where do I start?

I'm trying to build the basemap toolkit, from source, for matplotlib to run on my MacBook Pro under OS X 10.8. The C and C++ compiler are those included with the latest Xcode package. The package includes the geos-3.3.3 package which needs to be built separately and installed before the main basemap python package is built. When I do this, using the supplied Makefile, I get the following error when the makefile attempts to build the libgeos.dylib library:
Undefined symbols for architecture x86_64:
"std::auto_ptr<geos::geom::Envelope>::auto_ptr(std::auto_ptr_ref<geos::geom::Envelope>)", referenced from:
virtual thunk to geos::geom::GeometryCollection::computeEnvelopeInternal() constin libgeom.a(GeometryCollection.o)
"__ZNSt8auto_ptrIN4geos4geom8EnvelopeEEcvSt12auto_ptr_refIT_EIS2_EEv", referenced from:
virtual thunk to geos::geom::GeometryCollection::computeEnvelopeInternal() constin libgeom.a(GeometryCollection.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
On a Fedora 17 machine, with gcc 4.7, this library builds successfully so there is obviously something going on with the Mac compiler/linker. However, I have no idea how to decode this message. What, for instance, is a "virtual thunk"? Any insight on how I can compile and build this on the Mac?
I used a different compiler and the problem went away. Try:
make CXX=c++
Worked for me. OSX 10.8.3, XCode 4.6.1.

Resources