Thread: MySQL and C

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    2

    MySQL and C

    As this is my first message here, greetings and salutations.

    I know this may seem to be a crude project which I'm involved in which has brought me here for help, so please bear with me.

    I'm currently heading development of a MUD (multi-user dungeon) game and wish to apply MySQL database storage for several aspects of data. I've worked with MySQL in Perl somewhat extensively but I find myself getting a headache trying to get it to work correctly in C.

    Per my MySQL/mSQL book, I've included mysql.h, which ended up needing a deviation to <mysql/mysql.h> -- I'm not a huge fan of indescrepencies right out of the starting gate, but that's another story. I can tell that my files are seeing it correctly as it's recognising MYSQL_RES/ROW, etc. However, when I compile I'm erroring out with 'underfined reference' to the numerous mysql calls.

    I know this may not be a MySQL-specific issue, but as I'm sure I'll quickly become a regular here with this topic, I figured I'd might as well open up a MySQL thread.

    Thanks in advance for any assistance.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    36
    make sure you have linked mysql's lib
    your makefile should like:

    LIBS = -L/usr/local/mysql/lib -lmysqlclient
    $(CC) -o $(EXECUTABLE) $(OBJS) $(LIBS)

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    2
    No go...
    Is it possible for it to only be partially seeing mysql.h? It recognises the variable types and errors out if I don't provide the correct syntax for the SQL routine, but doesn't seem to see it at the end of the make.

    Thanks

Popular pages Recent additions subscribe to a feed