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 » MySQL link error
MySQL link error [message #28286] Thu, 26 August 2010 11:26 Go to next message
kagzer is currently offline  kagzer
Messages: 4
Registered: August 2010
Location: Hungary
Junior Member
Hello everybody

I very new in U++, but it seem to be the best IDE for me.

But I can't go ahead with mysql, because the linker gives me error: LNK2019.

I've setted the mysql lbraries, take it to PATH and many things. Googled many hours and search within this forum but i've stucked...

Re: MySQL link error [message #28289 is a reply to message #28286] Thu, 26 August 2010 13:04 Go to previous messageGo to next message
andrei_natanael is currently offline  andrei_natanael
Messages: 262
Registered: January 2009
Experienced Member
Hello kagzer,

Could you post entire output of the linker not only LNK2019?

Andrei
Re: MySQL link error [message #28290 is a reply to message #28286] Thu, 26 August 2010 14:15 Go to previous messageGo to next message
kagzer is currently offline  kagzer
Messages: 4
Registered: August 2010
Location: Hungary
Junior Member
----- Core ( MSC9 DEBUG DEBUG_FULL BLITZ WIN32 MSC ) (1 / 3)
----- plugin/z ( MSC9 DEBUG DEBUG_FULL BLITZ WIN32 MSC ) (2 / 3)
----- mysqlconsapp ( MAIN MSC9 DEBUG DEBUG_FULL BLITZ WIN32 MSC ) (3 / 3)
Linking...
mysqlconsapp.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Upp::MySqlSession::Connect(char const *,char const *,char const *,char const *,int,char const *)" (?Connect@MySqlSession>@Upp@@QAE_NPBD000H0@Z) referenced in function "void __cdecl ConsoleMainFn_(void)" (?ConsoleMainFn_@@YAX
XZ)
mysqlconsapp.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Upp::SqlSession::~SqlSession(void)" (??1SqlSession@Upp@@UAE>@XZ) referenced in function __unwindfunclet$??0MySqlSession@Upp@@QAE>@XZ$0
mysqlconsapp.obj : error LNK2019: unresolved external symbol "public: __thiscall Upp::SqlSession::SqlSession(void)" (??0SqlSession@Upp@@QAE>@XZ) referenced in function "public: __thiscall Upp::MySqlSession::MySqlSession(void)" (??0MySqlSession@Upp@@QAE>@XZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "protected: virtual class Upp::SqlConnection * __thiscall Upp::MySqlSession::CreateConnection(void)" (?CreateConnection@MySqlSession>@Upp@@MAEPAVSqlConnection>@2>@XZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Upp::MySqlSession::Begin(void)" (?Begin@MySqlSession>@Upp@@UAEXXZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Upp::MySqlSession::Commit(void)" (?Commit@MySqlSession>@Upp@@UAEXXZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Upp::MySqlSession::Rollback(void)" (?Rollback@MySqlSession>@Upp@@UAEXXZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall Upp::SqlSession::GetTransactionLevel(void)const " (?GetTransactionLevel@SqlSession>@Upp@@UBEHXZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::String __thiscall Upp::SqlSession::Savepoint(void)" (?Savepoint@SqlSession>@Upp@@UAE?AVString@2>@XZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Upp::SqlSession::RollbackTo(class Upp::String const &)" (?RollbackTo@SqlSession>@Upp@@UAEXABVString>@2@@Z)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall Upp::MySqlSession::IsOpen(void)const " (?IsOpen@MySqlSession>@Upp@@UBE_NXZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::Vector<class Upp::String> __thiscall Upp::MySqlSession::EnumUsers(void)" (?EnumUsers@MySqlSession>@Upp@@UAE?AV?$Vector@VString>@Upp@@@2>@XZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::Vector<class Upp::String> __thiscall Upp::MySqlSession::EnumDatabases(void)" (?EnumDatabases@MySqlSession>@Upp@@UAE?AV?$Vector@VString>@Upp@@@2>@XZ)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::Vector<class Upp::String> __thiscall Upp::MySqlSession::EnumTables(class Upp::String)" (?EnumTables@MySqlSession>@Upp@@UAE?AV?$Vector@VString>@Upp@@@2>@VString>@2@@Z)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::Vector<class Upp::String> __thiscall Upp::SqlSession::EnumViews(class Upp::String)" (?EnumViews@SqlSession>@Upp@@UAE?AV?$Vector@VString>@Upp@@@2>@VString>@2@@Z)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::Vector<class Upp::String> __thiscall Upp::SqlSession::EnumSequences(class Upp::String)" (?EnumSequences@SqlSession>@Upp@@UAE?AV?$Vector@VString>@Upp@@@2>@VString>@2@@Z)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::Vector<struct Upp::SqlColumnInfo> __thiscall Upp::SqlSession::EnumColumns(class Upp::String,class Upp::String)" (?EnumColumns@SqlSession>@Upp@@UAE?AV?$Vector@USqlColumnInfo>@Upp@@@2>@VString>@2>@0>@Z)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::Vector<class Upp::String> __thiscall Upp::SqlSession::EnumPrimaryKey(class Upp::String,class Upp::String)" (?EnumPrimaryKey@SqlSession>@Upp@@UAE?AV?$Vector@VString>@Upp@@@2>@VString>@2>@0>@Z)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::String __thiscall Upp::SqlSession::EnumRowID(class Upp::String,class Upp::String)" (?EnumRowID@SqlSession>@Upp@@UAE?AVString@2>@V32>@0>@Z)
mysqlconsapp.obj : error LNK2001: unresolved external symbol "public: virtual class Upp::Vector<class Upp::String> __thiscall Upp::SqlSession::EnumReservedWords(void)" (?EnumReservedWords@SqlSession>@Upp@@UAE?AV?$Vector@VString>@Upp@@@2>@XZ)
mysqlconsapp.obj : error LNK2019: unresolved external symbol "bool __cdecl Upp::MySqlPerformScript(class Upp::String const &,struct Upp::StatementExecutor &,class Upp::Gate2<int,int>)" (?MySqlPerformScript@Upp@@YA_NABVString@1>@AAUStatementExecutor>@1>@V?$Gate2@HH>@1@@Z) referenced in function "public: virtual b
ool (__cdecl*__thiscall Upp::MySqlSession::GetRunScript(void)const )(class Upp::String const &,struct Upp::StatementExecutor &,class Upp::Gate2<int,int>)" (?GetRunScript@MySqlSession>@Upp@@UBEP6A_NABVString@2>@AAUStatementExecutor>@2>@V?$Gate2@HH>@2@@ZXZ)
mysqlconsapp.obj : error LNK2019: unresolved external symbol "public: void __thiscall Upp::MySqlSession::Close(void)" (?Close@MySqlSession>@Upp@@QAEXXZ) referenced in function "public: virtual __thiscall Upp::MySqlSession::~MySqlSession(void)" (??1MySqlSession@Upp@@UAE>@XZ)
C:\upp\out\MSC9.Debug.Debug_full\mysqlconsapp.exe : fatal error LNK1120: 22 unresolved externals

There were errors. (0:06.04)
Re: MySQL link error [message #28291 is a reply to message #28290] Thu, 26 August 2010 14:46 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
The problem is that you did not add the correct packages to your own package. You are using 3 packages, which is currently the minimum for console applications. "mysqlconsapp" is probably your own package. Core is the core of U++, and plugin/z is a dependency of Core, allowing it to provide compression and decompression services. Core does not feature Sql integration by itself. That is a job for another package.

You need to get used to the whole package idiom. Try to figure out what your project is made out of. So if you only have you code and the basics, you need to add a package that allows for Sql. This package is called Sql. You probably need the MySql package instead because you are using mysql.

PS: The fact that you can compile fine, but fail at linking is an unfortunate consequence of the way include paths work and you can include any file, even if you are not using the package if it is in the right location on disk.
Re: MySQL link error [message #28292 is a reply to message #28291] Thu, 26 August 2010 15:54 Go to previous messageGo to next message
kagzer is currently offline  kagzer
Messages: 4
Registered: August 2010
Location: Hungary
Junior Member
Here is the code:

#include <Core/Core.h>
#include <MySql/MySql.h>

using namespace Upp;

CONSOLE_APP_MAIN
{
int charSet = GetDefaultCharset() ;
Cout() << "charset:" <<CharsetName( charSet ) << "\n" ;
String s = "SELECT * FROM assyc;" ;

MySqlSession sesion ;
if (sesion.Connect( "username", "password", "database","hostip" ))
{
//
}
}
Re: MySQL link error [message #28293 is a reply to message #28292] Thu, 26 August 2010 16:14 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Menu Project/Add package to 'mysqlconsapp', select MySql and click Ok.
Re: MySQL link error [message #28294 is a reply to message #28293] Thu, 26 August 2010 16:30 Go to previous messageGo to next message
kagzer is currently offline  kagzer
Messages: 4
Registered: August 2010
Location: Hungary
Junior Member
I will draw up a statue for You:)
It works!

Thank You very much!!!
Re: MySQL link error [message #28863 is a reply to message #28294] Mon, 20 September 2010 14:37 Go to previous messageGo to next message
ratah is currently offline  ratah
Messages: 107
Registered: July 2010
Experienced Member
Hi everybody,

Experimentating on MySQL application, I have this link problem.


----- Core ( MT GCC FORCE_SIZE WIN32 ) (1 / 5)
----- MySql ( MT GCC FORCE_SIZE WIN32 ) (2 / 5)
----- plugin/z ( MT GCC FORCE_SIZE WIN32 ) (3 / 5)
----- Sql ( MT GCC FORCE_SIZE WIN32 ) (4 / 5)
----- insertionAFB ( MT MAIN GCC FORCE_SIZE WIN32 ) (5 / 5)
Linking...
c:/program files/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../.. /../mingw32/bin/ld.exe: cannot find -lmysql
collect2: ld returned 1 exit status


I copied everywhere the 3 libraries:

- libmysql.dll
- libmysql.lib
- mysqlclient.lib

Do someone can resolve/explain the reason

Thank you very much
Re: MySQL link error [message #51305 is a reply to message #28863] Mon, 04 March 2019 15:22 Go to previous message
Patisab is currently offline  Patisab
Messages: 21
Registered: December 2015
Location: France
Promising Member
Hello,

I have the same problem :

D:/Donnees/PBE-Pgm/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lmysql
collect2.exe: error: ld returned 1 exit status

Thank you for your help.

Bests regards.
Previous Topic: Connect to TWO databases
Next Topic: PostgreSQL and Mingw
Goto Forum:
  


Current Time: Thu Mar 28 12:46:55 CET 2024

Total time taken to generate the page: 0.00948 seconds