2012年1月9日 星期一

Header File and Include

Method 1: (Not very rigid)
1. Sometimes you wll write a sub module in the other file
2. then you didn't link it.
3. and can call it.



Method 2: (Serious)
1. you should Define function name before each function usage
2. you should add the header file.



{{{
Time_C.cpp

#include "vxWorks.h"
#include "timexLib.h"
#include "stdio.h"


#define ITERATIONS 200

/*Function Define Region */
int printit(void);
void timing(void);


void timing(void) {
printit();
}

int printit(void) {
int i;
for (i=0; i < ITERATIONS; i++) {
printf("Hello, I am i %d\n", i);
}
}

////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
Add the 'include ' Time_C content, then use the timeing
////////////////////////////////////////////////////////////
/* Define user function */
#include "Time_C.cpp"

void usrAppInit (void) {
#ifdef USER_APPL_INIT
USER_APPL_INIT; /* for backwards compatibility */
#endif

/* add application specific code here */
timing();
}





}}}

沒有留言:

張貼留言