List:MySQL++« Previous MessageNext Message »
From:Jim Wallace Date:March 26 2007 1:27am
Subject:RE: Problems with Visual C++
View as plain text  
I think the linker will complain if you give the library, but it doesn't
exist, so I think your settings are ok.

I assume you build MySQL++.  My next guess is that you have mismatched
C++ compiler options on the lib vs. your app.  I see all the unresolved
externs are cdecl, but the lib may have not have them that way.  I'd go
through all the settings for each project looking for mismatches.

You can turn on the verbose option of the linker, which may help.

Do dumpbin /exports mysqlpp.lib to see if you can find the missing items
the linker is barking about.

-----Original Message-----
From: Michael Nye [mailto:michael.nye@stripped] 
Sent: Sunday, March 25, 2007 9:01 PM
To: plusplus@stripped
Subject: Re: Problems with Visual C++

Yeah the program is using precompiled headers.  And that explains why
the first setup wasn't working.  I turned precompiled headers off and it
started making the same LNK errors.  I've checked the linker settings
and all appear to be fine,

Additional Library Directories: "C:\Program
Files\MySQL\mysql++-2.2.1\Debug";"C:\Program Files\MySQL\MySQL Server
5.0\lib\debug"
Additional Dependencies: libmysql.lib wsock32.lib mysqlpp.lib

I've tried playing with nearly every setting under Linker or C/C++ with
no success.  I've tried including different libraries such as
mysqlpp_util.lib as well as the above and it doesnt work.  Changing
lib\debug to lib\opt doesn't help either.  This is beginning to be very
frustrating as I really need to get this part of the project moving!  
The only things I can see remotely as out of place is in README.vc it
says to have "C:\mysql++\vc\debug" as a library directory, but there are
no files inside this directory... I have run the install.bat file and
just copy + pasted the resulting folders from C:\mysql++ to C:\Program
Files\MySQL\mysql++-2.2.1\ because that's where i've installed it.  To
be safe I installed mysql++ to C:\mysql++ and ran the install.bat file
again and got the same result

I'm pretty sure I followed all the instructions correctly but maybe I
missed something there.  Also there is no such option as "Under
Configuration Properties::General change "Use Managed Extensions" to
"No"" that I can see (using visual studio 2005).

Thanks for any help,

Michael.


Jim Wallace wrote:
> 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

Thread
Problems with Visual C++Michael Nye23 Mar
  • Re: Problems with Visual C++Warren Young23 Mar
    • Re: Problems with Visual C++Michael Nye24 Mar
      • Re: Problems with Visual C++gary clark24 Mar
        • Re: Problems with Visual C++Michael Nye25 Mar
          • RE: Problems with Visual C++Jim Wallace25 Mar
            • Re: Problems with Visual C++Michael Nye26 Mar
              • RE: Problems with Visual C++Jim Wallace26 Mar
                • Re: Problems with Visual C++Michael Nye28 Mar
        • Re: Problems with Visual C++Michael Nye26 Mar
Re: Problems with Visual C++Andre Sodermans29 Mar
  • Re: Problems with Visual C++Warren Young29 Mar
    • RE: Problems with Visual C++Matt Dargavel29 Mar
    • Re: Problems with Visual C++Warren Young29 Mar