Sign in to follow this  

multiple definition of..

This topic is 4864 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

Hello! I have a little problem. I get an error if I put my constructor function in a .cpp file
CArrow_i::CArrow_i( int x, int y, int w, int h, int bla )                 
             : CItem( x, y, w, h )
             {
                bla2 = bla;   
             }

then I get:

 multiple definition of `CArrow_i::CArrow_i( ...



It works if I put it in my .hpp file! ( in the class ) Thank you! :)

Share this post


Link to post
Share on other sites

#ifndef __CARROW_HPP__
#define __CARROW_HPP__



class CArrow_i : public CItem
{
public:
CArrow_i( int x, int y, int w, int h, int bla );
//..
//..
};


#endif

? =/

Share this post


Link to post
Share on other sites

#ifndef __CARROW_HPP__
#define __CARROW_HPP__

CItem__CArrow.hpp
class CArrow_i : public CItem
{
public:
CArrow_i( int x, int y, int w, int h, int bla );
//..
//..
};


#endif


.cpp
[/source]
#include "header.hpp"
CArrow_i::CArrow_i( int x, int y, int w, int h, int bla )
: CItem( x, y, w, h )
{
bla2 = bla;
}
[/source]
header.hpp

#include "CItem__CArrow"
//..


? :/
thank you


Share this post


Link to post
Share on other sites

This topic is 4864 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