Is it possible for Visual C ++ 2008 Express Edition to compile the C source code?

I want to learn C so that I can understand the concepts of many major programming languages ​​without the shortcuts that C ++ has or the garbage collectors that Java has. I plan to learn C and then switch to C ++, and now I am studying Computer Science.

In any case, I was wondering if the Visual C ++ 2008 Express Edition compiler for the Windows machine could compile the source C. I would have thought so, since you can implement C in C ++. However, when I try to create a file, there is no C selection. I can create header files, but I'm not sure which files I need for C or C ++. I know the minimum information.

If I cannot compile C with this compiler, is there another compiler with which I can compile C?

Thank.

+3
source share
5 answers

It compiles the source as a C89 dialect if you save it with the .c extension.

He will not compile C99.

+5
source

Just rename the “.c” file and it will be compiled in “C” mode.

Or right-click on project selection properties. Then go to Configuration Properties → C / C ++ → Advanced and set the “Compile As” parameter to “Compile as C code (/ TC"). A bit in parentheses is a command line switch if you want to use it.

+1
source

, .

".c" , C.

(C ++) ( ) ( ).

+1

, VC C89- C. , .c C. , , , C/++, Advanced, Compile As =/TC. .

Win32 Console, . ++. stdafx.cpp, stdafx.c. .cpp . C, .

- ++ . , .

+1

Something else worth mentioning, you should compile C code as C ++ without any problems. You might have binding problems if you use external code, since the C ++ compiler will use a different calling convention (and name management), but this should not be a problem if you just use your own code.

-1
source

Source: https://habr.com/ru/post/1752081/


All Articles