Thread: Statically Linking With The mySQLAPI

  1. #1
    Registered User
    Join Date
    Jun 2002

    Unhappy Statically Linking With The mySQLAPI

    I have written a program which performs basic actions on a mySQL database. This program is intended to be run on my web host's server, but does not have the required files to compile on that machine or use a dynamically linked executable on there.

    Thus I am left with having to compile a statically linked version on my local machine and upload from there.

    I'm having great difficulty in compiling it this way though.

    I do this:

    g++ -static generaltest.cpp -ogentest -L /usr/lib/mysql -lmysqlclient

    But get this:

    /usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_uncompress':
    my_compress.o(.text+0xaa): undefined reference to `uncompress'
    /usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_compress_alloc':
    my_compress.o(.text+0x13c): undefined reference to `compress'
    collect2: ld returned 1 exit status

    Scary! This doesn't happen when I do not use the -static though. Am I doing something wrong?

    Any help on what I need to do would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    Mar 2002
    The only thing I could think up (and it's probably wrong) is that the library you are linking to is just a reference to a dynamicly linked library, so the functions aren't really in the library, just the commands to import them. I have no idea how to fix that though.
    Typing stuff in Code::Blocks 8.02, compiling stuff with MinGW 3.4.5.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems linking with g++
    By Just in forum Linux Programming
    Replies: 11
    Last Post: 07-24-2006, 01:35 AM
  2. Replies: 8
    Last Post: 04-27-2006, 10:39 AM
  3. Grrr.... SDL Linking Problem
    By 7EVEN in forum Game Programming
    Replies: 5
    Last Post: 08-12-2005, 08:44 PM
  4. Linking error with DirectDrawCreateEx
    By jjj93421 in forum Game Programming
    Replies: 6
    Last Post: 04-06-2004, 03:57 PM
  5. help with allegro - linking errors
    By MadHatter in forum C++ Programming
    Replies: 1
    Last Post: 11-22-2002, 02:01 PM