dev-cpp and mysql

Discussion about everything. New games, 3d math, development tips...
Post Reply
Lunacore
Posts: 18
Joined: Sun May 30, 2010 4:01 pm
Location: Berlin (Germany)

dev-cpp and mysql

Post by Lunacore »

I've searched the web but I didn't find an answer to the following problem:
I want to make a connection to my database (MYSQL 5.5), but don't get the first step.

Code: Select all

#include <winsock2.h>
#include <mysql.h>
using namespace std;
MYSQL      mysql;

int main()
{
    mysql_init(&mysql);
    return 0;
}
I linked the following libs from the lib directory of MYSQL:
libmysql.lib
libmysqld.lib
mysqlclient.lib
mysqlservices.lib"
and add the include path from the MYSQL-directory.

While compiling, I get the (windows-)error:
"Id.exe funktioniert nicht mehr" (eng: "Id.exe has stopped working")

After the message, the compiler shows a lot of, mostly the same, errors:
.drectve `/DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
.drectve `/DEFAULTLIB:"libcpmt" /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
[Linker error] undefined reference to `@__security_check_cookie@4'
[Linker error] undefined reference to `_imp__connect@12'
[Linker error] undefined reference to `__security_cookie'

I use Windows 7 64bit and Dev-C++ (4.9.9.2) with Mingw/GCC 3.4.2 and run Dev-C++ as admin. Does anyone have the same error or have an idea, how to fix it?
Image
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Switch away from DevCpp. It's outdated and buggy.
Use Visual Studio or Code::Blocks
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
pippy3
Posts: 155
Joined: Tue Dec 15, 2009 7:32 am

Post by pippy3 »

Sylence wrote:Switch away from DevCpp. It's outdated and buggy.
Use Visual Studio or Code::Blocks
I'd guess the .libs were built for a newer gcc, so this should fix it.

Linking is always nasty. Make sure you're not setting the libs to only debug/release. Make sure they're in the correct folder. Make sure they have the dll in the exe folder. Make sure the working directory is correct.

If it's too much hassle you'll probably find that mysql in a c++ app is not the right approach. Why not just make it connect to a server?
Post Reply