Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

n00blar

macrumors newbie
Original poster
May 17, 2012
6
0
USA
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.
 

960design

macrumors 68040
Apr 17, 2012
3,700
1,569
Destin, FL
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.
 

mufflon

macrumors 6502
Sep 15, 2006
264
2
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/ )
 

klaxamazoo

macrumors 6502
Sep 8, 2006
438
0
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.