Help with a simple function

How do you tell your program to switch to a different file? For example, you want the program to start in Primary.cpp and then go to German.cpp.

All files in a WindRiver project are compiled and linked together. To call any of the functions in another file you just invoke its name. In order to let each file know what is available in the others at compile time you usually add prototypes to all the functions in a header file. So if I had a primary.cpp file and german.cpp file I would add a header file, you could call it anything you want and put all the things you want available from every other file in there.

The preprocessor directives prevent the header file from being invoked multiple times during preprocessing

The simple example shows a set of functions in primary that call some functions in german to do math processing. By letting each file know what is available via a header file #include you can access any function from any file in the project. (pick up a good book on C++ for your team, like the one of O’Reilly titles, it will be handy for questions like this as you progress into more and more complex programs)

primary.cpp:

#include myHeader.h

int pfunc1(int arg1){
<stuff>
int someInt = gfunc(arg1);
return someInt;
}
float pfunc2(float arg1){
<stuff>
float someFloat = gfunc(arg1);
return someFloat;
}

german.cpp:

#include myHeader.h

int gfunc1(int arg1){
<stuff>
int someInt = arg1 / 2;
return someInt;
}
float gfunc2(float arg1){
<stuff>
float someFloat = arg1 * 3.1415926;
return someFloat;
}

myHeader.h:
#ifndef __myheaderh
#define __myheaderh

//function prototypes from primary.cpp
int pfunc1(int arg1);
float pfunc2(float arg1);

//function prototypes from german.cpp
int gfunc1(int arg1);
float gfunc2(float arg1);

#endif

If you can answer this question, that would help. How would you do it with regular ecplise?

Also, isn’t #include used for to include libraries?

I figured it out-you just need the prototypes not the #include. Thanks though.