Are you using precompiled headers? (which is on by default). In that
case anything before stdafx.h is not processed, so in your example the
mysql++.h is not really included. Autocomplete knows about it since
it's included, but it can't detect if it's compiled in or not.
The LNK errors indicate you're compiling ok, but you're not including
the library in the link step. To fix that you need update the linker
setting. Add these libs to your Linker->Input->Additional Dependencies:
libmysql.lib
mysqlpp.lib, and add the paths to those libraries in the
Linker->General->Additional Library Directories setting.
HTH
-----Original Message-----
From: Michael Nye [mailto:michael.nye@stripped]
Sent: Sunday, March 25, 2007 4:16 AM
To: plusplus@stripped
Subject: Re: Problems with Visual C++
Hi again,
I fixed the previous errors as it appeared I had the #include
<mysql++.h> in the wrong position. By putting it at the very start of
the program rather then after including the standard header file, all
the errors went away. But now I have a new error! My include code
looks as follows,
//Login.cpp
#include <mysql++.h>
#include "StdAfx.h"
#include "Login.h"
#include "Main.h" // The second form that opens after login using
namespace APOSSv2; // APOSSv2 is the project name
And now when i type mysqlpp:: it comes up with the autofill box and
gives me the option to use Connection, but when I put the code
mysqlpp::Connection con(false);
into a function and compile it I get compile errors (it compiles and
runs fine without mysqlpp::Connection con(false); code):
.\Login.cpp(15) : error C2653: 'mysqlpp' : is not a class or namespace
name
.\Login.cpp(15) : error C2065: 'Connection' : undeclared identifier
.\Login.cpp(15) : error C2146: syntax error : missing ';' before
identifier 'con'
.\Login.cpp(15) : error C3861: 'con': identifier not found
I've had a look around the web and most of the solutions are "make sure
you have included the header file" which I have done as far as I can
see. The strange thing to me is that why would it autocomplete and then
say it can't find the namespace. I thought it might still have
something to do with the placement of the #inlcude statement, so i try
it in the last possible position in between stdafx.h and login.h,
//Login.cpp
#include "StdAfx.h"
#include <mysql++.h>
#include "Login.h"
#include "Main.h"
using namespace APOSSv2;
which results in errors as follows (the error lines are too long to put
in an email, but they start like this...
Login.obj : error LNK2028: unresolved token (0A00084D) "void __cdecl
mysqlpp::create_vector<class...
Login.obj : error LNK2028: unresolved token (0A00084E) "void __cdecl
mysqlpp::create_vector(unsign...
Login.obj : error LNK2020: unresolved token (0A00085D) "private: static
class mysqlpp::mysql_ti_...
Login.obj : error LNK2020: unresolved token (0A000860) "private: static
class mysqlpp::mysql_t...
Login.obj : error LNK2001: unresolved external symbol "private: static
class mysqlpp::mysql_ti_sq...
Login.obj : error LNK2001: unresolved external symbol "private: static
class mysqlpp::mysql_t...
Login.obj : error LNK2019: unresolved external symbol "void __cdecl
mysqlpp::create_v...
Login.obj : error LNK2019: unresolved external symbol "void __cdecl
mysqlpp::create_v...
And if I include it anywhere below #include "Login.h" I get the [[[[
error C2872: 'IServiceProvider' : ambiguous symbol... ]]] which was the
original problem. I'm very inexperienced with Visual C++ so really
don't have much of an idea what is going wrong. A bit of code or a
sample project which uses windows forms and mysql++ that I could play
with to see where I've gone wrong, or any fixes to the above problems
would be great.
Thanks,
Michael.
--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:
http://lists.mysql.com/plusplus?unsub=1