Sign in to follow this  
rakoon2

multiple definition of..

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

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