David Ayliffe writes:
> Does anyone have any SIMPLE proggies written in C++ using the MYSQL++
> API library? Preferably MS Visual Studio 6 format.  If so can you please
> provide me a link for them or contact me over email directly.
> 
> I'm having problems compiling a project that just connects to the server
> issues a query and then exits.  I'm getting linker errors all over the
> shop (attatched)
> 
> ANY ADVICE FOR C++ DEVELOPMENT USING MYSQL++ API APPRECIATED
> 
> !! Sorry if you get this more than once !!
> 
> Thanks lots
> David Ayliffe ([EMAIL PROTECTED])
> Deleting intermediate files and output files for project 'mysqltest - Win32 Debug'.
> --------------------Configuration: mysqltest - Win32 Debug--------------------
> Compiling...
> mysqltest.cpp
> c:\vc\type_info1.hh(39) : warning C4800: 'int' : forcing value to bool 'true' or 
>'false' (performance warning)
> c:\vc\type_info1.hh(159) : warning C4800: 'unsigned int' : forcing value to bool 
>'true' or 'false' (performance warning)
> c:\vc\type_info1.hh(172) : warning C4800: 'int' : forcing value to bool 'true' or 
>'false' (performance warning)
> c:\vc\type_info1.hh(176) : warning C4800: 'int' : forcing value to bool 'true' or 
>'false' (performance warning)
> c:\vc\type_info1.hh(180) : warning C4800: 'int' : forcing value to bool 'true' or 
>'false' (performance warning)
> c:\vc\type_info1.hh(184) : warning C4800: 'int' : forcing value to bool 'true' or 
>'false' (performance warning)
> c:\vc\sql_query1.hh(37) : warning C4800: 'class SQLQuery *' : forcing value to bool 
>'true' or 'false' (performance warning)
> c:\vc\sql_query1.hh(135) : warning C4355: 'this' : used in base member initializer 
>list
> c:\vc\compare1.hh(48) : warning C4800: 'int' : forcing value to bool 'true' or 
>'false' (performance warning)
> c:\vc\result1.hh(33) : warning C4355: 'this' : used in base member initializer list
> c:\vc\result1.hh(42) : warning C4800: 'char' : forcing value to bool 'true' or 
>'false' (performance warning)
> Linking...
> mysqltest.obj : error LNK2001: unresolved external symbol "public: __thiscall 
>MysqlConnection::~MysqlConnection(void)" (??1MysqlConnection@@QAE@XZ)
> mysqltest.obj : error LNK2001: unresolved external symbol "public: bool __thiscall 
>MysqlQuery::exec(class std::basic_string<char,struct std::char_traits<char>,class 
>std::allocator<char> > const &)" (?exec@MysqlQuery@@QAE_NABV?$basic_string@DU?$char_
> traits@D@std@@V?$allocator@D@2@@std@@@Z)
> mysqltest.obj : error LNK2001: unresolved external symbol "public: bool __thiscall 
>MysqlConnection::real_connect(char const *,char const *,char const *,char const 
>*,unsigned int,char,unsigned int,char const *)" (?real_connect@MysqlConnection@@QAE_NP
> BD000IDI0@Z)
> mysqltest.obj : error LNK2001: unresolved external symbol _mysql_init@4
> mysqltest.obj : error LNK2001: unresolved external symbol _mysql_errno@4
> Debug/mysqltest.exe : fatal error LNK1120: 5 unresolved externals
> Error executing link.exe.
> 
> mysqltest.exe - 6 error(s), 11 warning(s)
> 
> #include "C:\VC\sqlplus.hh"
> #include <stdio.h>
> #include <windows.h>
> 
> #define MY_DATABASE   "telcent"
> #define MY_TABLE    "nazivi"
> #define MY_HOST     "localhost"
> #define MY_USER     "root"
> #define MY_PASSWORD ""
> #define MY_FIELD    "naziv"
> #define MY_PORT     "3306"
> #define MY_QUERY    "SELECT URL from my_table as t1, my_table as t2 where t1.field = 
>t2.field"
> 
> int  main (void) 
> {
>   Connection con(use_exceptions);
>       try {
>               ostrstream strbuf; unsigned int i=0; 
>               con.real_connect 
>(MY_DATABASE,MY_HOST,MY_USER,MY_PASSWORD,3306,(int)0,60,NULL);
>               Query query = con.query(); query << MY_QUERY; 
> //            ResUse res = query.use(); Row row; 
> //            strbuf << "delete from " << MY_TABLE << " where " << MY_FIELD << " in 
>(";
> //            for UPDATE just replace the above DELETE FROM with UPDATE statement
> //            for(0;row=res.fetch_row();i++) strbuf <<         row[0] << ","; if 
>(!i) return 0; 
>               string output(strbuf.str()); output.erase(output.size()-1,1); output 
>+= ")";
>               query.exec((const string&)output); // cout << output << endl;
>               return 0;
>       } catch (BadQuery er) { 
>     cerr << "Error: " << er.error << " " << con.errnum() << endl;
>     return -1;
>       }
> }


Hi!

First of all I hope you have used MySQL++ version for VC++.

Second, include sqlplus.hh as a last file.

Third, you have to add sqlplus lib and mysqlclient lib to your
project.


Regards,

Sinisa

      ____  __     _____   _____  ___     ==  MySQL AB
     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sinisa Milivojevic
    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:[EMAIL PROTECTED]
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Larnaca, Cyprus
  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____
  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
             /*/             \*\                Developers Team

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to