|
Re: Compile Error/Code Issue: msg#00036db.mysql.c++
I'm 100% sure that mysql++ is fine here. Have you compiled and run the example programs? If so then it's safe to say that mysql++ is all setup fine and that the problem is with your code. I strongly suggest a c++ mailing list because you will get more people willing to help out and this is becoming somewhat off-topic :) More than likely this is caused by the fact that the compiler can't work out which version of Connection you want. By including mysql++.h you are getting mysqlpp::Connection, but you bring it into global namespace with the using declaration, allowing you to declare instances of mysqlpp::Connection without writing "mysqlpp". Then, you forward declare another class called Connection. As far as the compiler is concerned, you now have two classes, both named Connection. It has no way of working out which version of Connection you actually want to use, so it works on the principle of "find the nearest thing called Connection", which is your forward declared class. This has no definition so you can't instantiate or use the object. And so it fails. May I refer you to this document: http://www.possibility.com/Cpp/CppCodingStandard.html - this is a pretty comprehensive document on c++ coding style but also has a lot of best practice tips, including, "Don't place using namespace directive at global scope in a header file. This can cause lots of magic invisible conflicts that are hard to track." Personally, I never use "using" because I like to be able to look at the code and know exactly what's going on without having to guess, and importantly I am guaranteeing never to run into these problems. Look at it from this point of view: have you spent less time working out what the problem is than you saved by not having to type "mysqlpp::"? Joel. -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=gcdmc-plusplus@xxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Compile Error/Code Issue: 00036, Freyja |
|---|---|
| Next by Date: | Storing BLOB using C constructs and no STL(string, streams etc): 00036, Ankur G35 Saxena |
| Previous by Thread: | Re: Compile Error/Code Issuei: 00036, Freyja |
| Next by Thread: | Re: Problems with mysql and mysql++ examples: 00036, Warren Young |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |