PDA

View Full Version : Solving "Undefined Symbol" errors



chronozphere
15-10-2010, 06:13 PM
Hey FPC-people,

I've bumped into a problem. I'm trying to compile my engine on windows with FPC/Lazarus but it doesn't work. This is strange because I can do it with Delphi on Windows and with FPC on Linux.

These are my errors:


meshtestproj.lpr(244,1) Error: Illegal COFF Magic while reading G:\n3d\repo\fpc-demos\precompiled\sdl.o
meshtestproj.lpr(244,1) Error: Undefined symbol: THREADVARLIST_SDL
meshtestproj.lpr(244,1) Error: Undefined symbol: RTTI_SDL_PSDL_JOYSTICK


First of all, I would like to know what these errors mean in general. Also, what can I try to solve these?

Thanks!

code_glitch
15-10-2010, 07:39 PM
Have you tried adding the -MDelpi switch to the command? It sometimes helps. What version of fpc are you using? 2.4.0 perhaps?

chronozphere
15-10-2010, 10:02 PM
I use "{$MODE Delphi}" in most of my files, so I guess that means yes. :)

Also, I'm using Lazarus so commandline tricks don't really help (unless you can explain how to do the same thing with Laz).

User137
15-10-2010, 10:09 PM
You should use latest daily snapshot for windows Lazarus. The official release is way outdated.

chronozphere
15-10-2010, 10:39 PM
Ok, are you referring to these?

http://www.hu.freepascal.org/lazarus/

I might give it a try, but first I'll explore my other options. I actually don't think that this is caused by using a different version.

grudzio
16-10-2010, 10:45 AM
meshtestproj.lpr(244,1) Error: Illegal COFF Magic while reading G:\n3d\repo\fpc-demos\precompiled\sdl.oI think that this error is caused by wrong version/format of the sdl.o file. Therefore deleting it and compiling again should work.

Maybe the win and linux fpc linkers require different format of the *.o files. This would explain why it compiles only on linux. As for Delphi, if I remember correctly, it uses .dcu files, not .o so also no problem there.

chronozphere
16-10-2010, 04:04 PM
I finally managed to solve it. :)

It seems that the project was using the wrong version of sdl.pas (the one stored in the lazarus directories). Still not sure why that caused the "Undefined symbol" errors.

@Grudzio: Your explanation seems plausible. I'll keep it in mind for when I encouter the COFF magic error again.