Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Multiple Souce Files

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Zerosignull   Members   

122
Like
Likes
Like

Posted 09 August 2001 - 11:57 PM

Im haveing a lil problem with getin my main souce file recognising my Objects created in my other source files eg.. ////////////////////////////////////// class _myClass { //has a bender if I specifying ne thing after //class when i compile this source file _myClass(); ~_myClass() public: void afunction(); }; extern _myClass WorkDamit; _myClass::afunction() { cout << "im working"; } /////////////////////////////////////// #include _myclass Workdamit; //wont compile past this point void main() { WorkDamit::aFunction(); } help!!! ~prevail by daring to fail~

#2 MatrixCubed   Members   

199
Like
Likes
Like

Posted 10 August 2001 - 12:32 AM

    
//////////////////////////////////////////////////

// MyClass.h


class MyClass
{
public:
void aFunction();
};

//////////////////////////////////////////////////

// MyClass.cpp


#include (MyClass.h)

void MyClass::aFunction()
{
// Do something

}

//////////////////////////////////////////////////

// Main.cpp


#include (MyClass.h)

MyClass a_class;

void main(void)
{

a_class.aFunction();

}



That's all, folks...



MatrixCubed
http://MatrixCubed.org








Edited by - MatrixCubed on August 10, 2001 7:33:25 AM

#3 Sandman   Members   

2210
Like
Likes
Like

Posted 10 August 2001 - 12:41 AM

The layout of your code isnt very clear from your post...
it should look something like this....

  

// IN MYCLASS.H //

class _myClass
{
public:
_myClass();
~_myClass();
void afunction();
};

extern _myClass WorkDamit;

// IN MYCLASS.CPP //


_myClass::afunction()
{
cout << "im working";
}

_myClass::_myClass()
{
}

_myClass::~_myClass()
{
}

// IN MAIN.CPP //////////////////////////


#include <stuff.h>
#include "myclass.h"

_myclass Workdamit;

void main()
{
WorkDamit::aFunction();
}



This should work, unless I have missed something....





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.