Page 1 of 1

[Request] Help with cpp files

Posted: Sun Feb 22, 2009 9:44 am
by opearn
hi every one,
i would like some info on using one cpp file containing code and using it with my main.cpp

e.g

if i have a file called helloworld.cpp in my src directory

and it contains code eg

Code: Select all

iprintf("      Hello World\n");
how do i call this code in my main.cpp file?

e.g

Code: Select all

/*---------------------------------------------------------------------------------

	$Id: main.cpp,v 1.13 2008/12/02 20:21:20 dovoto Exp $

	Simple console print demo
	-- dovoto


---------------------------------------------------------------------------------*/
#include <nds.h>
//#include <helloworld_cpp.h>?
int main(void) {
	while(1) {
       // (helloworld.cpp... unknown code here)?
	}
	return 0;
}
i would like to know how to do this because i'm making a first person shooter and would like to contain most of the code i seperate files, to maintain cleanliness.
i would also need to be able to use variables in the code snipet that are read by main.cpp after the code snippet has executed...

Re: [Request] Help with cpp files

Posted: Sun Feb 22, 2009 10:16 am
by opearn