|
mysqltest error LNK2019: unresolved external symbol _mysql_connect@16 referenced in function "public: struct opendbstruct * __thiscall sql_connection_c::grabdb(void)" (?grabdb@sql_connection_c@@QAEPAUopendbstruct@@XZ)
I got this message when i was trying to compile the code copied from the sample. Can somebody please tell me how to fix it?
|
|
|
|
|
look at mysql manual , " c api part--> mysql_real_connect() " , u can find below message :
"This function is deprecated. It is preferable to use mysql_real_connect() instead. "
, so , u can use mysql_real_connect() ,and
edit some code in mysqlplus.cpp , after u do
this , rebuid , and everthing is ok now !!
|
|
|
|
|
when I retrieve a date variable from my database, I get a 0000-00-00 value from a record where there is a date? any hints
If it's broken, I probably did it
bdiamond
|
|
|
|
|
The other error I submitted was solved by placing the includes where they belonged properly. Now I get the following
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
trymysql.cpp:
Error E2303 c:\Borland\Bcc55\include\mysqlplus.h 81: Type name expected
Error E2139 c:\Borland\Bcc55\include\mysqlplus.h 81: Declaration missing ;
*** 2 errors in Compile ***
The second line below is line 81 of mysqlplus, in class sql_query_c
private:
vector_c <sql_result_c *=""> results;
};
I have no idea as I'm fairly new to C++, so any help is appreciated
Patrick
|
|
|
|
|
Any ideas why I would get the following error:
Error E2209 mysqlplus.h 9: Unable to open include file 'mysql.h'
I have the following in my directory that I’m doing the compile in: my_alloc.h, mysql.h, mysql_com.h, mysql_version.h, mysqlplus.h, and vector.h; along with the sample file shown above with the inputs adjusted to my db.
Patrick
|
|
|
|
|
I'm also new to VC++ environment. I'm not sure about my answer. I think you should add MYSQL server header files(F:\tools\MYSQL 4.1\include) in include path(Tools->Options->Directories->include files) will solve the problem.
Thanks,
Karthikeyan
|
|
|
|
|
I gave you a high mark, because your wrapper class was easy and fast to implement into my own project. Thanks!
There was however one problem, which I solved by setting warnings off and adding following line, to mysqlplus.cpp :
#pragma warning( disable : 4716 ) // Disable warning messages 4716.
Johnny
ps! I know you refer to MySQL homepage for download of interface, but you only need a few files, this you could have in your project, that would make your example even more professional.
|
|
|
|
|
I gave you a high mark, because your wrapper class was easy and fast to implement into my own project. Thanks!
Johnny
|
|
|
|
|
When I compiled your code, I found an error "error C2065: 'mysql_connect' : undeclared identifier". I have already included "mysql.h". How can I get through this. Thank you for your answer.
|
|
|
|
|
Did you remember the .dll file ??? I think this function resides in the .dll file, try and download interface from mysql homepage.
|
|
|
|
|
If using MS VisualC++:
There are more headers than "mysql.h" needed.
You should include the mysql include path to your workspace, i.e. "C:\MYSQL\INCLUDE".
For linking do the same with mysql lib path, i.e. "C:\MYSQL\LIB"
With MS VC6.0 no problems to compile ...
For execution copy the correct libMySql.dll file to your project's DEBUG or RELEASE directory.
|
|
|
|
|
Hi,
I found this on newer MySQL 4.1.x [4.1.7 to be exact]
A number of calls have been depreciated in 4.x
Defining USE_OLD_FUNCTIONS will let the compiler see the old mysql_connect, but I found it still wouldn't link.
So, if you are including the <mysql.h> and thats all good, try applying the fix in my earlier post [Compiling on new MySQL..], this worked for me.
It upgrades the script to use the new mysql_real_connect instead of the old mysql_connect
HTH
Mark
Windows, Linux And Internet Development Consultant
http://www.scriptsmiths.co.za
|
|
|
|
|
change line 118 of "mysqlplus.cpp" :
if ( !mysql_connect( &odb->mysql, host, user, password ) )
{
//fprintf( stderr, "mysql_connect(%s,%s,***) failed\n", host, user );
errc = 2;
}
by :
if ( !mysql_real_connect( &odb->mysql, host, user, password, database, 0, NULL, 0 ) )
{
//fprintf( stderr, "mysql_connect(%s,%s,***) failed\n", host, user );
errc = 2;
}
|
|
|
|
|
I am testing mySQL C++ Wrapper. But get the following compilation errors:
mysqlplus.h (lines 102 - 105)
-----------------------------
ISO C++ forbids declaration of 'oprators=' with no type
mysqlplus.cpp(lines 391, 399, 407 ..)
------------------------------
ISO C++ forbids declaration of 'oprators=' with no type
I am using the Bloodshed Dev C++ compiler (ref: www.bloodshed.net).
Do you have any suggestions?
Thanks,
Pete
|
|
|
|
|
I think you have to modify your function to something like this
const sql_var_c &sql_var_c::operator = ( const char *s )
{
*this = (char *)s;
return *this;
}
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
thanks, i had the same problem and this works !
|
|
|
|
|
Theres not really an article and it seems to just be an example from the MySQL project anyway. You should modify it, write an article, and explain things.
Matt
|
|
|
|
|
a simple wrap,
http://www.mysql.com/products/mysql++/index.html
here is a C++ lib using template,
but i doubt if it's efficient.
I download it and complie,
but vc7.1 give me many template erors,
I'd give up because i have no more time for it.
In their page, they wrote"if you complie yourself, you maybe meet a lot of errors..."
it seems they know it.
|
|
|
|
|
First, this was not intended to explain mySQL. If you want to learn mySQL, check their online manual. This is just a simple wrapper that makes the coding with their library a lot easier... as the C++ wrapper they have built is very non-efficient, and badly structured... If you know about mySQL and look at the header, you'll understand it.
Gonçalo A.
|
|
|
|
|
I think he doesn't ment you should explain mySQL, I agree this is far from a good article.
You could explain what are the methods of your wrapper classes, why did you wrote this classes and stuff like that.
You shouldn't expect the reader knows what your subjet of work is.
I think codeproject is not just a place to get code, it's a place people can learn.
Also is usefull to people that knows mySQL just to read the article and decide from it whether is usefull for them
there are only 10 kind of people in the world, those who read binary code and those who doesn't
|
|
|
|