Confusing undefined function which I know is defined

Jonathan Wakely
Sun Nov 10 21:58:00 GMT 2013

On 10 November 2013 20:52, awsdert wrote:
> It shouldn't be a linker issue given that it is being compiled into 1 DLL at
> the moment, also I thought I had sent the output, shows up here:
> where the problem was originally posted. If there is something else I'm
> looking for to send you then please tell me.

It doesn't show up in the official list archives: is not the home of this list, and apparently doesn't
accurately forward what you posted.

For the benefit of this list:

-------------- Build: msw86d_cpp_gcc in zxStuff (compiler: GNU GCC

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\endian\zxcopy.c -o
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\endian\zxcopybits.c -o
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\endian\zxIntEndian.c -o
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
undefined reference to `zxVECTOR_resize'
undefined reference to `zxVECTOR_opAdd'
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.

More information about the Gcc-help mailing list