Jump to content
  • Advertisement
Sign in to follow this  
rakoon2

multiple definition of..

This topic is 5056 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
Advertisement

#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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!