Using SDL with XCode 4.4 - xcode

I am trying to use XCode 4.4 to run SDL but am running into problems. I followed the directions exactly from this site http://www.lazyfoo.net/SDL_tutorials/lesson01/mac/xcode/index.php but it did not compile and gave me the following error.
Ld
/Users/Jeffrey/Library/Developer/Xcode/DerivedData/SDL_test1-gymiyuicyswxljbpwkggciejevaj/Build/Products/Debug/SDL_test1
normal x86_64
cd /Users/Jeffrey/Documents/Documents/Engineering/SDL_test1
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/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/Jeffrey/Library/Developer/Xcode/DerivedData/SDL_test1-gymiyuicyswxljbpwkggciejevaj/Build/Products/Debug
-F/Users/Jeffrey/Library/Developer/Xcode/DerivedData/SDL_test1-gymiyuicyswxljbpwkggciejevaj/Build/Products/Debug
-F/Library/Frameworks -filelist /Users/Jeffrey/Library/Developer/Xcode/DerivedData/SDL_test1-gymiyuicyswxljbpwkggciejevaj/Build/Intermediates/SDL_test1.build/Debug/SDL_test1.build/Objects-normal/x86_64/SDL_test1.LinkFileList
-mmacosx-version-min=10.8 -framework SDL -framework Cocoa -o /Users/Jeffrey/Library/Developer/Xcode/DerivedData/SDL_test1-gymiyuicyswxljbpwkggciejevaj/Build/Products/Debug/SDL_test1
Undefined symbols for architecture x86_64: "_main", referenced from:
-u command line option
(maybe you meant: _SDL_main) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code
1 (use -v to see invocation)
the only discrepancy is in step 9 (Go into the SDLmain.m template file you added and change #include "SDL.h" to #include "SDL/SDL.h") I didn't actually find the include statement but instead an import statement. I tried both ways, however.
Any help would be appreciated.
I am using a Macbook Pro with the Mountain Lion operating system.

Not sure if you are still having trouble with this but if you are I have made a couple of tutorials for OSX getting SDL set up.
Xcode - Setup SDL on OSX in Xcode
Eclipse - Setup SDL on OSX in Eclipse
The Xcode version has a link to my Xcode SDL2 template which makes starting up very easy.

Related

How to compile program with freeglut library with a Mac using g++

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

How can I get the RInside example sandboxed_server to work on OS X Yosemite?

I'm having trouble getting the sandboxed_server example from RInside/examples/sandboxed_server working on xcode. I have OS X Yosemite 10.10.1.
I get the following error:
clang++ server/rinsideserver.o common/binarystream.o datatypes/bar.o datatypes/foo.o example_server.o -F/Library/Frameworks/R.framework/.. -framework R -llzma -lz -licucore -lm -liconv -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/Library/Frameworks/R.framework/Resources/lib -lRlapack /Library/Frameworks/R.framework/Versions/3.1/Resources/library/RInside/lib/libRInside.a -o example_server
Undefined symbols for architecture x86_64:
"RInside::set_callbacks(Callbacks*)", referenced from:
_main in example_server.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: *** [example_server] Error 1
Command /usr/bin/make failed with exit code 2
I have not been able to get any example that uses callbacks to work. Examples (from standard examples) that don't use callbacks do work.
I've uncommented #define RINSIDE_CALLBACKS in RInsideConfig.h. I've reinstalled the source files through R/CRAN from source- as was suggested on another post.
I did modify the code in sandboxed_server to get CLOCK_MONOTONIC to work on mac- but nothing other than that.
I'd really like to get this example working. Any help would be greatly appreciated!

Using SDL with xCode 4.5

I know there are several questions regarding this. I have looked through them all but still haven't found an answer.
I'm trying to use SDL with xCode on my Mac. I'm using xCode 4.5
I followed this tutorial exactly, twice! I even tried a second tutorial which was basically the same and it still didnt compile.
When i compile i get this error:
Ld /Users/shardy/Library/Developer/Xcode/DerivedData/SDL_SetUp-efqnmqdzqqtkktbodsopeytuwjxt/Build/Products/Debug/SDL_SetUp normal x86_64
cd "/Users/shardy/Desktop/shardy/C++ Programs/GlutApps/SDL_SetUp"
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/shardy/Library/Developer/Xcode/DerivedData/SDL_SetUp-efqnmqdzqqtkktbodsopeytuwjxt/Build/Products/Debug -F/Users/shardy/Library/Developer/Xcode/DerivedData/SDL_SetUp-efqnmqdzqqtkktbodsopeytuwjxt/Build/Products/Debug -F/Library/Frameworks -filelist /Users/shardy/Library/Developer/Xcode/DerivedData/SDL_SetUp-efqnmqdzqqtkktbodsopeytuwjxt/Build/Intermediates/SDL_SetUp.build/Debug/SDL_SetUp.build/Objects-normal/x86_64/SDL_SetUp.LinkFileList -mmacosx-version-min=10.7 -stdlib=libc++ -framework SDL -framework Cocoa -o /Users/shardy/Library/Developer/Xcode/DerivedData/SDL_SetUp-efqnmqdzqqtkktbodsopeytuwjxt/Build/Products/Debug/SDL_SetUp
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
(maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Followed by:
"_main", referenced from:
Start in crt1.10.6.o
(maybe you meant:_SDL_main)
Symbol(s) not found for architecture x86_64
Linker command failed with exit code 1 (use -v to see invocation)
I was originally using xCode 4.3 and it wouldnt compile, so i updated to xCode to 4.5 thinking maybe xCode was causing issues and tried everything again, but unfortunately, still did not compile...
I am not experienced enough to know how to fix this and i am out of relatable threads to read...
Thanks.

Openssl Mach-O linker error for architecture i386 and armv7

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.

Cannot build Qt SDK from source on Mac OS X

I've been trying to build the SDK statically on Mac OS X but I run into errors that don't make sense to me. Here is my configure command:
sh configure -static -opensource -universal
Then I build the framework using:
sudo make sub-src
The build process works well initially but after some time, I start getting errors like the ones below, there are hundred of these:
ranlib: for architecture: i386 file: /usr/local/Trolltech/Qt-4.7.1/lib/libQtScript.a(ARMAssembler.o) has no symbols
ranlib: for architecture: i386 file: /usr/local/Trolltech/Qt-4.7.1/lib/libQtScript.a(MacroAssemblerARM.o) has no symbols
Then after some time, the build process hits this command:
g++ -headerpad_max_install_names -Xarch_i386 -mmacosx-version-min=10.4 -Xarch_ppc -mmacosx-version-min=10.4 -arch i386 -arch ppc -all_load -o ../../../../bin/Assistant.app/Contents/MacOS/Assistant .obj/debug-static/fontpanel.o .obj/debug-static/aboutdialog.o .obj/debug-static/bookmarkdialog.o .obj/debug-static/bookmarkfiltermodel.o .obj/debug-static/bookmarkitem.o .obj/debug-static/bookmarkmanager.o .obj/debug-static/bookmarkmanagerwidget.o .obj/debug-static/bookmarkmodel.o .obj/debug-static/centralwidget.o .obj/debug-static/cmdlineparser.o .obj/debug-static/contentwindow.o .obj/debug-static/findwidget.o .obj/debug-static/filternamedialog.o .obj/debug-static/helpenginewrapper.o .obj/debug-static/helpviewer.o .obj/debug-static/indexwindow.o .obj/debug-static/installdialog.o .obj/debug-static/main.o .obj/debug-static/mainwindow.o .obj/debug-static/preferencesdialog.o .obj/debug-static/qtdocinstaller.o .obj/debug-static/remotecontrol.o .obj/debug-static/searchwidget.o .obj/debug-static/topicchooser.o .obj/debug-static/xbelsupport.o .obj/debug-static/collectionconfiguration.o .obj/debug-static/helpviewer_qtb.o .obj/debug-static/moc_fontpanel.o .obj/debug-static/moc_aboutdialog.o .obj/debug-static/moc_bookmarkdialog.o .obj/debug-static/moc_bookmarkfiltermodel.o .obj/debug-static/moc_bookmarkmanager.o .obj/debug-static/moc_bookmarkmanagerwidget.o .obj/debug-static/moc_bookmarkmodel.o .obj/debug-static/moc_centralwidget.o .obj/debug-static/moc_contentwindow.o .obj/debug-static/moc_findwidget.o .obj/debug-static/moc_filternamedialog.o .obj/debug-static/moc_helpenginewrapper.o .obj/debug-static/moc_indexwindow.o .obj/debug-static/moc_installdialog.o .obj/debug-static/moc_mainwindow.o .obj/debug-static/moc_preferencesdialog.o .obj/debug-static/moc_qtdocinstaller.o .obj/debug-static/moc_remotecontrol.o .obj/debug-static/moc_searchwidget.o .obj/debug-static/moc_topicchooser.o .obj/debug-static/moc_helpviewer_qtb.o .obj/debug-static/qrc_assistant.o .obj/debug-static/qrc_assistant_images.o -L/Users/laurent/.Trash/qt-src-4.7.1/lib -L/Users/laurent/.Trash/qt-src-4.7.1/plugins/sqldrivers -lQtHelp_debug -L/Users/laurent/.Trash/qt-src-4.7.1/lib -lQtCLucene_debug -L/usr/local/Trolltech/Qt-4.7.1/plugins/sqldrivers -lqsqlite_debug -lQtSql_debug -lQtXml_debug -lQtGui_debug -framework Carbon -framework AppKit -lQtNetwork_debug -framework SystemConfiguration -framework CoreFoundation -lQtCore_debug -lz -lm -framework ApplicationServices
which is followed by hundreds of these lines:
ld: warning: qt_noop() has different visibility (hidden) in /Users/laurent/.Trash/qt-src-4.7.1/lib/libQtHelp_debug.a(qhelpenginecore.o) and (default) in .obj/debug-static/fontpanel.o
ld: warning: QBool::operator void const*() consthas different visibility (hidden) in /Users/laurent/.Trash/qt-src-4.7.1/lib/libQtHelp_debug.a(qhelpenginecore.o) and (default) in .obj/debug-static/fontpanel.o
after that, I get many of these:
Undefined symbols for architecture ppc:
"QCLuceneStandardAnalyzer::QCLuceneStandardAnalyzer()", referenced from:
fulltextsearch::clucene::QHelpSearchIndexWriter::optimizeIndex() in libQtHelp_debug.a(qhelpsearchindexwriter_clucene.o)
fulltextsearch::clucene::QHelpSearchIndexWriter::run() in libQtHelp_debug.a(qhelpsearchindexwriter_clucene.o)
fulltextsearch::clucene::QHelpSearchIndexReaderClucene::boostSearchHits(QHelpEngineCore const&, QList >&, QList const&)in libQtHelp_debug.a(qhelpsearchindexreader_clucene.o)
fulltextsearch::clucene::QHelpSearchIndexReaderClucene::run() in libQtHelp_debug.a(qhelpsearchindexreader_clucene.o)
At that point, the build process stops with this error:
ld: symbol(s) not found for architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file: /var/tmp//cc5nBJvn.out (No such file or directory)
make[4]: *** [../../../../bin/Assistant.app/Contents/MacOS/Assistant] Error 1
make[3]: *** [sub-assistant-install_subtargets-ordered] Error 2
make[2]: *** [sub-tools-install_subtargets-ordered] Error 2
make[1]: *** [sub-assistant-install_subtargets-ordered] Error 2
make: *** [sub-tools-install_subtargets-ordered] Error 2
My config is Snow Leopard and I'm building from the source downloaded there:
http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.1.tar.gz
Can anybody see what could be the problem? I've been working on this for hours and can't figure it out, so I would really appreciate any advice.
Your problem:
ld: symbol(s) not found for architecture ppc
If you build for 10.6, AFAIK PPC is not supported. If you want to build for PPC, then you'll probably need to build for a different target version of OS X - 10.4 or 10.5.

Resources