I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index » Programming » C/C++ »

Trying to make a program with MySql Library

neandertal\′s Photo
26 Jan 08, 12:29AM
(4 replies)
Trying to make a program with MySql Library
I'm trying to do a program to connect with a MySql database and modify values... I downloaded and installed the Dev-c++ libmysql package but doing "#include <mysql.h>" but it throw me an error and I don't know how to do this,
will\′s Photo
26 Jan 08, 12:13PM
What errors exactly. Which compiler are you using?
neandertal\′s Photo
27 Jan 08, 9:36PM
I use Dev-c++ with the package libmysql installed. I tried to do the most simple code to compile it:

#include <stdio.h> #include <mysql/mysql.h>

int main() { return 0; }

With that code it throw me thoose errors:

In file included from J:/Dev-Cpp/include/mysql/mysql.h:57, from J:\Documents and Settings\Guido\Mis documentos\prueba_mysql_1.cpp:2: J:/Dev-Cpp/include/mysql/mysql_com.h:175: error: `SOCKET' does not name a type

J:/Dev-Cpp/include/mysql/mysql_com.h:339: error: `SOCKET' was not declared in this scope J:/Dev-Cpp/include/mysql/mysql_com.h:339: error: expected primary-expression before "const" J:/Dev-Cpp/include/mysql/mysql_com.h:339: error: expected primary-expression before "unsigned" J:/Dev-Cpp/include/mysql/mysql_com.h:340: error: expected primary-expression before "unsigned" J:/Dev-Cpp/include/mysql/mysql_com.h:340: error: initializer expression list treated as compound expression
will\′s Photo
28 Jan 08, 10:08AM
Don't know if this answers your problem: http://forums.mysql.com/read.php?45,102840,104450#msg-104450

i.e. For the compile error when including <mysql.h>, it seems that you haven't set the include path in Project->Project Options->Directories->Include Directories. In "Include Directories", add the directory where packman installed the mysql headers (on my system is is c:\Dev-Cpp\include\mysql).

To link with the mysql library, you'll need to add -lmysql to the linker parameters in Project->Project Options->Parameters.
neandertal\′s Photo
29 Jan 08, 7:42PM
Y tryed all thats thinks, include the directory and add the parameters but it still throwing me the same errors, it's look like it found the library but i don't know where are those errors.
Currently you need to be logged in to leave a message.