|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|
All times are GMT -5. The time now is 11:49 PM.