-
2 files 1 project
If I make 2 files in 1 project, and I execute it, but I want to execute only 1 file how do I do it?
I made a project with 2 files in it, 1 is int main() and 1 is int submain() now how do I execute the submain file? only int main() executes and I get to errors pls help.
-
You must have a function called int main.
If you you only compile and link one file, then both files needs int main.
-
Code:
void main(void){ // ;)
submain();
}
-
Global variables will be constructed before main() executes, but other than that only the runtime environment can execute something before main().
Code:
struct foo
{
foo ( ) { submain(); }
} runbefore;
int main()
{
}
Most of the time something like this is not appropriate.