Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile C app with Visual Studio 2012

I plan to write application in C using Microsoft Visual Studio 2012. The problem is that I can't find a way to compile it right in the editor. I found this solution http://msdn.microsoft.com/en-us/library/bb384838.aspx but I dont like it. Can you recommend me a way to compile C program right in the Visual Studio 2012?

like image 635
ddrisit Avatar asked Dec 20 '11 18:12

ddrisit


People also ask

Can Visual Studio compile C programs?

The Visual Studio build tools include a C compiler that you can use to create everything from basic console programs to full Windows Desktop applications, mobile apps, and more.

Can you program C in Visual Studio Code?

C/C++ support for Visual Studio Code is provided by a Microsoft C/C++ extension to enable cross-platform C and C++ development on Windows, Linux, and macOS.

Does CPP compiler work with C?

All C++ compilers also support C linkage, for some compatible C compiler. When you need to access a function compiled with C linkage (for example, a function compiled by the C compiler, or a function written in assembler), declare the function to have C linkage.

Which compiler does Visual Studio use for C?

CMake, Clang, mingw, and more Use MSBuild with the Microsoft Visual C++ compiler or a 3rd party toolset like CMake with Clang or mingw to build and debug your code right in the IDE.


1 Answers

It is a little bit tricky to compile plain C90 and C++x0 (only partially supported) projects in VS2010 (and probably Visual Studio 11, I haven't tried native development in it yet).

What you have to do is to create a new C++ project without precompiled header -- this is the primary requirement if you want to compile a platform-independent code (library, console application).

There are several ways to do it. One way is to create a normal Win32 C++ console application, in the opened wizard you should go to the second page (by clicking "Next") and then uncheck the option "Include precompiled header". Then you can compile C++ (and C) projects directly in VS.

like image 110
Alexander Galkin Avatar answered Oct 12 '22 01:10

Alexander Galkin