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.