Confusing undefined function which I know is defined

Sun Nov 10 22:20:00 GMT 2013

On 11/11/2013 05:57, Jonathan Wakely wrote:
> mingw32-gcc.exe -ansi -D_DLL -D_UNICODE -DUNICODE  -shared -D_WIN32
> -DZXBUILD_DLL -D_WINDLL    -Iinclude -I  -c
> C:\Me\Prjs\cpp\zxStuff\svn\trunk\src\zx\event\zxEVENT.c -o
> .objs\src\zx\event\zxEVENT.o
> C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o:zxEVENT.c:(.data+0xfc):
> undefined reference to `zxVECTOR_resize'
> C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o:zxEVENT.c:(.data+0x100):
> undefined reference to `zxVECTOR_opAdd'
> c:/apps86/tools/codeblocks12-11/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe:
> C:\Users\Lee\AppData\Local\Temp\cczuTp1t.o: bad reloc address 0x100 in
> section `.data'
> collect2.exe: error: ld returned 1 exit status
> Process terminated with status 1 (0 minutes, 3 seconds)
> 2 errors, 0 warnings (0 minutes, 3 seconds)
> As I thought, the errors shown are linker errors, not compiler errors.
>  You are using -shared to compile single object files, that is wrong.
> You probably want to use -fPIC to compile each file, then use -shared
> to combine them into a single .dll file.  So your codeblocks settings
> must be wrong, but that is not a GCC problem so this is the wrong
> mailing list.

No, -fpic does not have any function for mingw, it is likely because
-shared and -c are used at the same time.

The linker should not be involved yet if it is just compiling to object.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Gcc-help mailing list