Hi, wonder if anyone can advice. I've got a C program with two (yes two!)
main() functions. During compilation I want only want part to compile
depending on what has been passed to gcc.
I've heard that I should be able to do something like
#ifdef SECTION_1
int main(int argc, char *argv)
{
/* First version of main() */
.......
}
#endif
#ifdef SECTION_2
int main(int argc, char *argv)
{
/* Second version of main() */
.......
}
#endif
and during compile I should be able to do something like
gcc -DSECTION_2 progname.c -o progname
to compile SECTION_2 only but I've not been very successful. Any ideas?
Thanks.