Sign in to follow this  

Need help about using many lib in VC 2005

This topic is 3589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

This topic is 3589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this