Multiple source files in a C/C++ Application project ( NetBeans )
c, c++, netbeans-7, user-interface
Solution
For the same project you could have many source files `*.c` and `*.h` and others
But for the same project you could have only one `main()` function in all of the source files
Example:
Code architecture:
.
└── source_folder
├── file1.c
├── file2.c
└── main.c
file1.c
#include <stdio.h>
void printfile1()
{
printf("this is the file1.c\n");
}
file2.c
#include <stdio.h>
void printfile2()
{
printf("this is the file2.c\n");
}
main.c
#include <stdio.h>
void printfile1(); //prototype definition
void printfile2(); //prototype definition
int main()
{
printfile1();
printfile2();
}
Problem
I created a new C/C++ project via `File > New Project > C/C++ > C/C++ Application`. However, under the `Source Files` folder, only 1 source file with `main` is allowed. Is there any way to include more than 1 `main` source file in the `Source Files` folder ? Or do I have to create a new project for each source file ? In contrast, for each Java project, there can be many `.java` files in it. I am trying to find the same functionality for C/C++ applications. Thanks.