I have looked in all the settings for hours for a way to fix this but I can't find an answer. I am new to programming so please post easy instructions if you can.
If I use the project wizard and make a C project, then everything works fine.
But if I use the file wizard and make a C file, or if I make a blank file and name it file.c, then when I try to compile programs, it compiles in C++. I do have a .c file from a few weeks ago that does compile in C, but if I copy it for example, its new copy won't.
For example: (somebody gave me this on another forum)
#include<stdio.h>
int main ( ) {
#ifdef __cplusplus
printf("Compiled as C++\n");
#else
printf("Compiled as C\n");
#endif
return 0;
}
outputs "Compiled as C++"
and:
#include <stdio.h>
#include <stdlib.h>
enum country {italy, america, france, brazil, england, newzealand, nepal, switzerland, canada, australia};
typedef enum country country;
int main(void)
{
country tmpcountry;
for(tmpcountry = 0; tmpcountry <= 9; ++tmpcountry)
printf("%d\n", tmpcountry);
return 0;
}
has compile errors (because C++ doesn't let you do arithmetic with enum, but C does let you.
I can't make all my programs in projects for school reasons. Can anyone tell me simply how to fix this? Thanks!