BioBytes Messages: 307 Registered: October 2008 Location: France
Senior Member
Hi all,
I tried to compile an app skeleton based on the use of mysql 5.0 under MINGW. Following the indications already published on UPP forum, I added paths to MYSQL Server directories (path, include and lib) to the Build environment and to the MYSQL.h header file. All the ISO and related error to mysql types disappear but there is still one error remaining :
DBPrjMain.cpp
DBProject: 1 file(s) built in (0:04.23), 4234 msecs / file, duration = 4250 msecs, parallelization 0%
Linking...
D:\logiciels\dvt\ultimate\mingw\bin/ld.exe: cannot find -lmysql
collect2: ld returned 1 exit status
captainc Messages: 278 Registered: December 2006 Location: New Jersey, USA
Experienced Member
The linker is looking for the library file from the mysql 5 installation. For MINGW: libmysql.a/libmysql.so, for MSC: mysql.lib/mysql.dll. You will have to make sure your lib path from TheIDE settings can see the library files or to specify -Idirectory as extra parameter to the linker.
sergeynikitin Messages: 748 Registered: January 2008 Location: Moscow, Russia
Contributor
I has solved this problem under Win XP by Installing MS Visio C++ 2005 and then autoconfig TheIDE (check include paths - mysql include must be in list). (I can compile ONLY in DEBUG mode).
Under MINGW - problem are stay.
Maybe anybody know how to compile mysql under MinGW. (Step By Step).
Maybe ask Mirek to include some version of mysql's mingw lib files to Uppsrc as package (or upload ready to compile package to some site).
BioBytes Messages: 307 Registered: October 2008 Location: France
Senior Member
Thanks both of you for your reply. I have added libmysql.a to the Mingw bin directory and all is compiling without any error. But as soon as I declare an object like :
private:
MySqlSession DBprj;
I get a compiler error like "MySqlSession does not have a name type". This is very similar the error obtained when you try to compile an app based on OleDB with MINGW compiler (I have understood that in that case a MSC must be used). But what about mySql?
If I suppress the MySqlSession object, no error is happening.
BioBytes Messages: 307 Registered: October 2008 Location: France
Senior Member
Hi CaptainC and Sergey,
I have added all the information related to the compiling issue in the attached zipped file.
Why I do not understand is that all seems to go the right way and then just have a "does not name type" error at the final step. I have also joined the Build config and the file header that contains the MySqlSession object.
I wonder if there could a problem with the MYSQL version (I use 5.1) and the version of the libmysql.a library.
BioBytes Messages: 307 Registered: October 2008 Location: France
Senior Member
Thanks you Sergey for your comments and help.
I will download VC++ studio express this weekend and try to compile my code according to your template. I will back to the forum to confirm if it works.
forlano Messages: 1202 Registered: March 2006 Location: Italy
Senior Contributor
captainc wrote on Wed, 12 November 2008 20:33
The linker is looking for the library file from the mysql 5 installation. For MINGW: libmysql.a/libmysql.so, for MSC: mysql.lib/mysql.dll. You will have to make sure your lib path from TheIDE settings can see the library files or to specify -Idirectory as extra parameter to the linker.
Hello,
I've MSVS9 and I need to download the necessary files and libs to work with MySql and U++. The download list at http://www.mysql.com/downloads/
is a bit confusing for me. What have I to download?
forlano Messages: 1202 Registered: March 2006 Location: Italy
Senior Contributor
forlano wrote on Sun, 14 February 2010 11:40
I've MSVS9 and I need to download the necessary files and libs to work with MySql and U++. The download list at http://www.mysql.com/downloads/
is a bit confusing for me. What have I to download?
Thanks,
Luigi
I got the answwer. The right download is the package
mysql-connector-c-6.0.2-win32.msi
PS: I have just discovered that using
sql.Execute("...");
and
sql.Fetch()
I can easily replicate all my PHP scripts. Very nice. Upp is a continue discovery
The linker is looking for the library file from the mysql 5 installation. For MINGW: libmysql.a/libmysql.so, for MSC: mysql.lib/mysql.dll. You will have to make sure your lib path from TheIDE settings can see the library files or to specify -Idirectory as extra parameter to the linker.