mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mingw-cross-env-list] Undefined references when building Objective-C so


From: Dimitris Papavasiliou
Subject: [Mingw-cross-env-list] Undefined references when building Objective-C sources
Date: Sat, 2 Jun 2012 14:27:56 +0300

Hello,

I'm trying to port my application which is written in objective-C (but
without using the GNUStep or any other foundation classes) to windows.
Largely thanks to the mxe doing most of the work for me I've sort of
succeeded but I have this problem:  When trying to link statically to
libobjc which is the Objective-C runtime library I get a lot of of
undefined references to symbols that should be there but which the
linker seems to use with a _imp_ prepended to their name.  I believe
this has something to do with dll vs. static libraries in windows but
I haven't been able to find any concrete information.  I have
successfully managed to compile the core of my application by changing
gcc.mk to enable shared libraries and linking against a shared version
of libobjc but then I have problems with other parts of my project.

I've attached a small application to demonstrate the problem.
Building this with gcc as usual:

gcc test.m -lobjc

works fine but building with mingw results in the following:

$ i686-pc-mingw32-gcc test.m -lobjc
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/libobjc.a(class.o): In
function `class_table_next':
/opt/mxe/tmp-gcc/gcc-4.7.0/libobjc/class.c:295: undefined reference to
`_imp__objc_free'
/opt/mxe/tmp-gcc/gcc-4.7.0/libobjc/class.c:264: undefined reference to
`_imp__objc_malloc'
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/libobjc.a(class.o): In
function `class_table_insert':
/opt/mxe/tmp-gcc/gcc-4.7.0/libobjc/class.c:190: undefined reference to
`_imp__objc_malloc'
...

Did I do something wrong when building gcc or test.m?  Any insight is
greatly appreciated.

Dimitris

Attachment: test.m
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]