I created windows console program project in visual studio, and made two c language files. Both has same source:
#include<stdio.h>
int main() {
printf("hello");
}
When I try to compile, compiler screams about having two main()
s. See below:
I can't understand. I thought two files in one project works separately. Am I wrong?
Yes, you are wrong. IIRC, the whole project is compiled and then linked to form a single executable.
In a single executable, there can be only one main()
function.