Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For a cross-platform project, we are using wxwidgets to create a cross-platform GUI in c++. WxWidgets was installed on Mac OSX 10.7 using macports. We have no problems with compiling our source-code on Linux and Windows.

Compiling our different classes works fine on Mac. However, when we try to link the objects we get the following errors/warnings:

ld: warning: ignoring file ../../obj/games.o, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file ../../obj/lobby.o, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file ../../obj/ConfigFile.o, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file ../../obj/net.o, file was built for unsupported file format which is not the architecture being linked (i386)
 ld: warning: ignoring file ../../obj/protocol.o, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
 "_main", referenced from:
    start in crt1.10.6.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

It seems as gcc can't link the files. When we want to compile and link one file at once, we get a working program. As we now have multiple files, which we want to link, we can't do this at once. We use the following makefile:

https://github.com/timvdalen/OGO-2.3/blob/master/src/lobby/Makefile

Our source code is also included there. I use the following version of gcc:

gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Has anyone an idea how we can link these files?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I already found the answer myself: you have to compile using g++ -arch i386. The linker seems to only want to link in 32-bit mode.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.