trivial borland c++ linker error (with SDL)

Started by
13 comments, last by Gaal Dormick 18 years, 11 months ago
Why is your error '_SDL_GetError' instead of 'SDL_GetError'?
Advertisement
The naming convention of the compiler I'm guessing. It outputs object files with "_" appendended to the front. Microsft's compilers do something simpilar and also append "@16" meaning 16 bytes pushed onto the stack when it's called (forgot what level this is done at - the final dll, or import lib...). Yeah, I belive there should be a standard for linking code. I had a hell of a time getting things going with nasm. Don't take any of this as correct - I haven't been worked with linkers in several months (took a break with Java).
Gaal: correct, I'm unaware of any compiler that does NOT prepend an underscore to a C symbol, although I'm (fairly) sure they exist. I vaugely remember GCC maybe having an option to turn this off. Being a pretty defacto (or official?) standard I wouldn't recommend that though.

If you want my 2 cents, I'd switch over to Cygwin or MinGW, both of which are windows ports of GNU software. If you want a free IDE as well I'd get Eclipse, a Java based IDE designed for developing Java, but is great for developing in C/C++ if you install the CDT plugin, and runs completely seamlessly atop a cygwin installation (and with a few hiccups atop MinGW I've found).

Personally, I chose MinGW, as by default Cygwin links in some GPLed library stuff (which is disableable with an extra flag, but I hate extra flags :P). Getting Eclipse to work with it was a simple matter of creating a copy of mingw32-make.exe as make.exe so I wouldn't have to change the make command for every managed make C/C++ project in eclipse, adding C:\MinGW\bin to %PATH%, and ignoring the fact that Eclipse can't find the "rm" command (the GNU/Linux version of "del").
The error message implies that the symbol is not present in your SDL.lib. So, your SDL.lib is most likely corrupt. Off hand I can only imagine a few typical causes for this:

1. You fouled up the order of arguments in implib and created a junk 1KB SDL.lib file. This is an easy mistake but it does not fit your problem. You should be missing more symbols and more errors would be generated if this were the case.

2. The SDL.dll from which you generated the SDL.lib was corrupt or compiled without SDL_GetError. You could try compiling SDL.dll yourself with freebcc. The latest SDL (1.2.8) will not compile on freebcc without some slight changes. You need to add cpuinfo.c to the SDL.mak and add a couple typecasts in SDL_dibevents.c and SDL_dx5events.c.

The page you linked to in the OP also has a link to the help files for this compiler. Use those help files to figure out why ilink has those extra commas.
I ran a dumpbin /exports on SDL.dll and SDL_GetError is there. I'll look into MingW. I don't want Eclipse though - ugh. Complex, graphical IDE's are not my bag. Anyway, I tried compiling something with borland that is easily compiled with VC++ and got some nonsense errors. It's going out the door.

This topic is closed to new replies.

Advertisement