Sign in to follow this  

dynamic vs static link error, Mac OS X

Recommended Posts

I'm new to Mac OS X; picked up a nice new MacBook to do cross platform development on (working with SDL, GTK, etc). For my new, recent project I've run into a link error I've not seen before: /usr/bin/ld: main.o is input for the dynamic link editor, is not relocatable by the static link editor again Googling has given me little understanding of this issue: from what I can tell, by building main.cpp into main.o, g++ in darwin is making it a dynamically linkable library? So it's not allowing me to link it in the way I am accustomed. Here is my (very simple) makefile:

.SUFFIXES = .cpp .o

GTK_INIT = `pkg-config --cflags --libs gtk+-2.0`
BOOST_LIB = -lboost_filesystem -I/opt/local/include -L/opt/local/lib


all:		pictview

pictview:	$(OBJECT_FILES)
	g++ $(OBJECT_FILES) -o pictview $(GTK_INIT) $(BOOST_LIB)

main.o:		main.cpp
	g++ main.cpp -o main.o $(GTK_INIT) $(BOOST_LIB)
	rm pictview
	rm main.o

Please note that I am able to compile/build if I put it all on one line...but this project (and many others I work on) will end up being quite large, spanning multiple it's necessary to build each object file individually so that modifying only one doesn't require I rebuild the entire project. I'm sure many of you are familiar with this in general. Does anyone have experience with this Mac-side? Any and all help is appreciated =) Thanks!

Share this post

Link to post
Share on other sites
This thing is great =) I've been using the text-editor portion of XCode, which is a bit rough. I'll definately look into both of those apps.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this