CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: MySql...

  1. #1
    Join Date
    Mar 2009
    Posts
    19

    MySql...

    For some reason I'm getting a lot of compiling errors that make it seem like it's not including the file: mysql.h ..

    I don't understand why it's giving me these errors because it doesn't seem like it should be.. The errors are like this:

    Code:
    ..\obj\Debug\src\database.o(.text+0xd27)||In function `ZN8Database7ConnectENS_6EngineESsSsSsSs':|
    C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|73|undefined reference to `mysql_init@4'|
    ..\obj\Debug\src\database.o(.text+0xd3f):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|75|undefined reference to `mysql_error@4'|
    ..\obj\Debug\src\database.o(.text+0xdd4):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|77|undefined reference to `mysql_real_connect@32'|
    ..\obj\Debug\src\database.o(.text+0xded):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|79|undefined reference to `mysql_error@4'|
    ..\obj\Debug\src\database.o(.text+0xe40):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|81|undefined reference to `mysql_select_db@8'|
    ..\obj\Debug\src\database.o(.text+0xe58):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|83|undefined reference to `mysql_error@4'|
    ..\obj\Debug\src\database.o(.text+0x113f)||In function `ZN8Database5QueryEPKcz':|
    C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|125|undefined reference to `mysql_real_escape_string@16'|
    ..\obj\Debug\src\database.o(.text+0x124e):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|158|undefined reference to `mysql_real_query@12'|
    ..\obj\Debug\src\database.o(.text+0x1262):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|160|undefined reference to `mysql_error@4'|
    ..\obj\Debug\src\database.o(.text+0x12ca):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|163|undefined reference to `mysql_field_count@4'|
    ..\obj\Debug\src\database.o(.text+0x12dd):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|165|undefined reference to `mysql_store_result@4'|
    ..\obj\Debug\src\database.o(.text+0x1300):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|169|undefined reference to `mysql_affected_rows@4'|
    ..\obj\Debug\src\database.o(.text+0x133a):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|174|undefined reference to `mysql_error@4'|
    ..\obj\Debug\src\database.o(.text+0x13a0):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|178|undefined reference to `mysql_fetch_fields@4'|
    ..\obj\Debug\src\database.o(.text+0x13b1):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|180|undefined reference to `mysql_fetch_row@4'|
    ..\obj\Debug\src\database.o(.text+0x1a98):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|180|undefined reference to `mysql_fetch_row@4'|
    ..\obj\Debug\src\database.o(.text+0x1ab8):C:\Users\Alex\Desktop\eoserv-trunk-r74\trunk\src\database.cpp|213|undefined reference to `mysql_free_result@4'|
    ||=== Build finished: 17 errors, 0 warnings ===|

  2. #2
    Join Date
    Mar 2004
    Location
    KL, Malaysia
    Posts
    63

    Re: MySql...

    mysql.h only contains the header prototype information, the linker can't seem to locate the actual object or library file. Make sure you also supply that.

  3. #3
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: MySql...

    You need to link to either libmysql.lib or mysqlclient.lib, the former is for dynamic loading of the mysql DLL, the later is for static linking.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured