|Dec 19, 2012, 04:23 PM||#1|
Adding a header file to Xcode
First off, the following question was posted already, about a few months ago in these forums; however, I seem to have a slightly different error message, and I can't find the answer for this issue in the place where I got this header file.
When building the project, I get the following error message:
Undefined symbols for architecture x86_64:
"_GetString", referenced from:
_main 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)
I installed these files using the following commands:
gcc -c -ggdb -std=c99 cs50.c -o cs50.o
ar rcs libcs50.a cs50.o
rm -f cs50.o
chmod 0644 cs50.h libcs50.a
sudo mv cs50.h /usr/include
sudo cp libcs50.a /usr/lib
My version of Xcode is: Version 4.5.2 (4G2008a) and I'm running OS X 10.7.5.
I have no clues as to how to get this to work. Thanks for any suggestions.
|Dec 20, 2012, 12:06 PM||#2|
I'm sorry, I don't know the answer to your question. I think it would be difficult for most of us to guess at an answer. Here's the typical help desk response:
Have you tried uninstalling and reinstalling XCode? I'd recommend doing it via the app store. I haven't had any problems on any of my systems.
TI-99/4A, tape cassette, 12" B&W Zenith
|Dec 20, 2012, 03:26 PM||#3|
Check your project setup, it looks like a linking problem. check if xcode & your project is referencing your newly compiled static linked library correctly (or at all).
If that won't help remove the library, add it again and restart xcode.
If that won't help check that your compile targets are correct (compiling for a correct platform) - not normally a problem.
If that still won't work then check the course homepage about compilation (which I found by googling it): https://manual.cs50.net/CS50_Library#Mac_OS
They mention other compile steps which you don't seem to do (at a cursory glance) and some different directories (i.e. usr/local instead of usr/ )
|Dec 20, 2012, 07:57 PM||#4|
I've had this happen a few times when I forget to close my projects between different computers when running SugarSync.
1) Make sure that the header file for the class you are having a problem with is actually linked to your target. I usually remove the file in Xcode and the drag-n-drop it back being sure to check the box specifying the targets.
2) You can also try closing Xcode and deleting the "Derived Data" folder for that project.
|cs50, cs50.h, edx, os x 10.7.5, xcode 4.5.2|
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|What would make images in the header pop out on top of the rest of the header?||MuckrakerJG||Web Design and Development||1||Feb 2, 2014 01:53 AM|
|Adding an Image in Xcode 4.5||Blakeasd||Mac Programming||2||Dec 15, 2012 09:34 AM|
|Adding an Image in Xcode 4.5||Blakeasd||OS X 10.8 Mountain Lion||1||Dec 14, 2012 08:32 PM|
|#import or #include header file - file not found||MickeyT||iPhone/iPad Programming||4||Jul 2, 2012 01:58 AM|
|Help with adding and subtraction in Xcode||kingv84||Mac Programming||5||Jun 18, 2012 04:36 PM|
All times are GMT -5. The time now is 03:49 PM.