Need help about using many lib in VC 2005

Started by
1 comment, last by Trentelshark 16 years, 2 months ago
I'm using VC 2005 as my IDE and I also using many library together in my project, also with my own developed library (static lib). the problem is, I try to use wxWidgets as my GUI module everything work fine as it should be. until I type #include <my developed library> the program can't compile the error is Error 34 error C2556: 'BOOL ScApp::OnInit(void)' : overloaded function differs only by return type from 'bool ScApp::OnInit(void)' c:\documents and settings\user\my documents\visual studio 2005\projects\datadreampackage\scbuilder\src\scapp.cpp 6 Error 35 error C2371: 'ScApp::OnInit' : redefinition; different basic types c:\documents and settings\user\my documents\visual studio 2005\projects\datadreampackage\scbuilder\src\scapp.cpp 6 and this one the error done when I move include statement to .cpp files (now it on .h) and I think this line make sence on .h file more than .cpp any one know how to solve this problem please give me some advice Thank you Best Regards, Chet Chetchaiyan
Advertisement
Quote:Original post by Neon2302
Error 34 error C2556: 'BOOL ScApp::OnInit(void)' : overloaded function differs only by return type from 'bool ScApp::OnInit(void)' c:\documents and settings\user\my documents\visual studio 2005\projects\datadreampackage\scbuilder\src\scapp.cpp 6

Error 35 error C2371: 'ScApp::OnInit' : redefinition; different basic types c:\documents and settings\user\my documents\visual studio 2005\projects\datadreampackage\scbuilder\src\scapp.cpp 6


The first error is easy as it tells you exactly what is wrong. BOOL is a different type than bool, so you essentially have made a new function. However, your 'new function' needs different parameters in order to be correct. Change either BOOL to bool or bool to BOOL depending on what your needs are.

I'm not as sure on the second error, but I bet it will go away when you fix the first one.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!

Quote:Original post by Neon2302
Error 35 error C2371: 'ScApp::OnInit' : redefinition; different basic types c:\documents and settings\user\my documents\visual studio 2005\projects\datadreampackage\scbuilder\src\scapp.cpp 6

The compiler is telling you that there are two versions of ScApp::OnInit with nearly identical parameters defined. For example, this would result in an error C2371:

C++
class ScApp{public:   void OnInit( int i, float i );};


Note that both parameters are named "i" but are of "different basic types". If you check your intellisense you'll notice .NET is trying to create two version of the method in an overloaded fashion but with only one definition is unable to do so.

There is a very basic definition of the error in the MSDN (which when developing with Microsoft's suite of products I would recommend checking first for each and every compile/link error you do not understand) which can be found here:

MSDN Link for C2371

This topic is closed to new replies.

Advertisement