Dev C++/mySQL linker errors

This is a discussion on Dev C++/mySQL linker errors within the C Programming forums, part of the General Programming Boards category; Not sure exactly what forum this post belongs to but I'm having trouble trying to link library files to compile ...

  1. #1
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    Question Dev C++/mySQL linker errors

    Not sure exactly what forum this post belongs to but I'm having trouble trying to link library files to compile simple mysql client below is the code I have just to test the mySQL C API funcions.:
    Code:
    #include <stdio.h>
    #include <winsock.h>
    #include <mysql.h>
    #include <stdlib.h>
    
    MYSQL connection;
    
    int main (void)
    {
    printf ("This is an SQL test.\n\n");
    printf ("Attempting to access mySQL API funcs...\n");
    printf ("Calling mySQL init:\n");
    
    if( !mysql_init(&connection))
    fprintf (stderr, "Initialisation failed. Error: %s\n", mysql_error(&connection));
    
    printf ("Attempting to login....\n");
    
    if ( !mysql_real_connect(&connection, "localhost", "lan", "","test", 0,NULL,0) )
    fprintf (stderr, "Failed to connect to database. Error: %s. \nTry again later.\n", mysql_error(&connection)); 
    
    getchar();
        
    return 0;
    }
    I get errors along the lines of:
    [Linker error] undefined reference to `mysql_real_connect@32'
    at least with anything to do with the mySQL API. I have tried linking in the library file from the mySQL lib folder but the mysqlClient throws so many errors at me that I'm stumped.
    Any help would be greatly appreciated.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Did you make sure to include the library as such: goto project options -> parameters ->add library or object -> mysqlclient ?

    Or did you do it a different way?

  3. #3
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    I actually added it to the project options the way you just specified. 's just the four errors to the mySQL API.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker errors with 2005 Express
    By thetinman in forum Windows Programming
    Replies: 4
    Last Post: 12-30-2006, 09:04 AM
  2. Linker errors...
    By MipZhaP in forum Game Programming
    Replies: 2
    Last Post: 08-27-2004, 10:12 AM
  3. Question About Linker Errors In Dev-C++
    By ShadowMetis in forum C++ Programming
    Replies: 9
    Last Post: 08-18-2004, 09:42 PM
  4. dev & allegro compile errors
    By Calgore in forum C++ Programming
    Replies: 10
    Last Post: 08-11-2004, 05:41 PM
  5. Linker errors with simple static library
    By Dang in forum Windows Programming
    Replies: 5
    Last Post: 09-08-2001, 10:38 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21