[freetds] Undefined references to all database functions

panssarikomppania at gmail.com panssarikomppania at gmail.com
Thu May 22 03:42:45 EDT 2008

2008/5/21, James K. Lowden <jklowden at freetds.org>:
> Correctomundo, it's a linkage problem.  Either the library isn't really
>  being linked in (or was built wrong and doesn't have those symbols), or
>  the symbol the application wants is somehow different from the one
>  exported by the library.
>  I had to look it up: Dev-C++ is a MinGW front-end.  If one side or the
>  other were compiled as C++, the symbols wouldn't match because of
>  mangling.
>  You want to use the GNU binutils to see what's what, and look closely at
>  the command line (I assume is) generated by Dev-C++.  Make sure 1) it's
>  compiling as C, not C++, and 2) that libsybdb is really being linked in.

I checked it out, everything is compiled as C, not C++. I also took a
look at the Dev-C++ command line, the whole thing is below.

Compiler: Default compiler
Building Makefile: "C:\path\to\project\Makefile.win"
Executing make clean
rm -f ../project/main.o ../project/project_private.res project.exe
gcc.exe main.c -o ../project/main.o -I"C:\path\to\Dev-cpp\include" -i
project_private.rc --input-format=rc -o ../project/project_private.res
-0 coff --include-dir C:\path\to\Dev-cpp\lib" -lsybdb
gcc.exe ../project/project.o ../project/project_private.res
"project.exe" -L"C:\path\to\Dev-cpp\lib" -lsybdb
main.c: Undefined reference to 'dbinit'.
main.c: Undefined reference to 'dblogin'.
main.c: Undefined reference to 'dbclose'.
Collect2: ld returned 1 exit status
make.exe:***[project.exe] Error 1
Execution terminated

So everything compiles as it should, but linking fails. I don't know
what goes wrong with the linking, it looks like it just fails to find
those symbols. If it helps you, I'm using FreeTDS version
0.83.dev.20080518. The .dev.20080518 rings some alerts. Am I using a
week old snapshot? If I am, then I guess I should revert to the latest
stable version and see if that helps at all.

Thanks in advance

More information about the FreeTDS mailing list