first off.. i used the search function and found problems that are about the same.. only no solution is working for me..
i`m new to programming c++ and i mainly want to learn it to connect to a mysql database and show infor from the database.. so it`s just normal to start with a simple mysql.cpp script that just makes a connection to mysql and shows if it`s connected or not.. but the compiling itself is going wrong..
This is the script:
so the script seems to be fine.. no errors there.. than i try to compile it.. this is the error that i get (i`m compiling on Windows XP SP2 in the commant prompt.)
using namespace std;
fprintf(stderr, "Failed to connect to database: Error: %s\n",
cout << "FINALLY CONNECTED" << endl;
i tried to get it working with about all they say here: http://dev.mysql.com/doc/refman/5.0/...compiling.html but no luck.. and -lmysql is also one of the options i tried..
C:\Programming\mysql_connection>g++ mysql.cpp -o mysql.exe
C:\DOCUME~1\Mark\LOCALS~1\Temp/ccW8caaa.o(.text+0x13d):mysql.cpp: undefined refe
rence to `mysql_init@4'
C:\DOCUME~1\Mark\LOCALS~1\Temp/ccW8caaa.o(.text+0x15e):mysql.cpp: undefined refe
rence to `mysql_options@12'
C:\DOCUME~1\Mark\LOCALS~1\Temp/ccW8caaa.o(.text+0x1a7):mysql.cpp: undefined refe
rence to `mysql_real_connect@32'
C:\DOCUME~1\Mark\LOCALS~1\Temp/ccW8caaa.o(.text+0x1bc):mysql.cpp: undefined refe
rence to `mysql_error@4'
collect2: ld returned 1 exit status
so do any of you guys know what i might do wrong?