Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Compiling error for mysql
Compiling error for mysql [message #19098] Wed, 12 November 2008 14:56 Go to next message
BioBytes is currently offline  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

There were errors. (0:07.48)


Is anybody have an idea about it ?

Thanks in advance for help

Kind regards

Biobytes
Re: Compiling error for mysql [message #19103 is a reply to message #19098] Wed, 12 November 2008 20:33 Go to previous messageGo to next message
captainc is currently offline  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.
Re: Compiling error for mysql [message #19105 is a reply to message #19103] Wed, 12 November 2008 20:56 Go to previous messageGo to next message
sergeynikitin is currently offline  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).


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Compiling error for mysql [message #19106 is a reply to message #19098] Wed, 12 November 2008 21:11 Go to previous messageGo to next message
BioBytes is currently offline  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.

Please could you comment ?

Thank you aggain for your advices

Best regards
Biobytes
Re: Compiling error for mysql [message #19115 is a reply to message #19106] Thu, 13 November 2008 00:36 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
That's strange.
whats the exact error output?
Re: Compiling error for mysql [message #19118 is a reply to message #19098] Thu, 13 November 2008 09:46 Go to previous messageGo to next message
BioBytes is currently offline  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.

Hoping that could be heplful,

Kind regards
Biobytes
Re: Compiling error for mysql [message #19119 is a reply to message #19118] Thu, 13 November 2008 10:19 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

this code are working
	MySqlSession session;
	if(!session.Connect(app.mysql_username, app.mysql_password, app.mysql_database, app.mysql_server)) {
		printf("Can't connect with MySql\n");
		PromptOK(t_("Can't connect with MySql"));
		return;
	}
	mysql_set_character_set(session, "utf8");
	
	SQL = session;
	Sql sql(session);


under linux (ubuntu 8.04 - compiler GCC) and
under windows (XP - compiler Visual Studio 2005)


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Compiling error for mysql [message #19129 is a reply to message #19098] Fri, 14 November 2008 09:54 Go to previous messageGo to next message
BioBytes is currently offline  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.

Best regards
Biobytes
Re: Compiling error for mysql [message #19133 is a reply to message #19118] Fri, 14 November 2008 14:38 Go to previous messageGo to next message
captainc is currently offline  captainc
Messages: 278
Registered: December 2006
Location: New Jersey, USA
Experienced Member
Quote:

I wonder if there could a problem with the MYSQL version (I use 5.1) and the version of the libmysql.a library.

Just make sure the headers and the compiled libraries are from the same exact version... otherwise, it should be fine (backwards compatible at least).
Re: Compiling error for mysql [message #25210 is a reply to message #19103] Sun, 14 February 2010 11:40 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
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?

Thanks,
Luigi
Re: Compiling error for mysql [message #25792 is a reply to message #25210] Thu, 11 March 2010 21:34 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
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

to be downloaded from
http://www.mysql.com/downloads/connector/c/

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 Smile
Re: Compiling error for mysql [message #29123 is a reply to message #25792] Wed, 06 October 2010 12:07 Go to previous messageGo to next message
ratah is currently offline  ratah
Messages: 107
Registered: July 2010
Experienced Member
Hi,

Quote:

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.


Where can i do TheIDE settings

Thank you
Re: Compiling error for mysql [message #29165 is a reply to message #29123] Fri, 08 October 2010 11:27 Go to previous message
ratah is currently offline  ratah
Messages: 107
Registered: July 2010
Experienced Member
http://www.ultimatepp.org/forum/index.php?t=msg&goto=291 64&#msg_29164

[Updated on: Fri, 08 October 2010 11:31]

Report message to a moderator

Previous Topic: Issue with sql.execute(const String&)
Next Topic: Always MySQL Link error
Goto Forum:
  


Current Time: Thu Mar 28 21:53:19 CET 2024

Total time taken to generate the page: 0.01475 seconds