简体   繁体   中英

How to compile and execute C program on Visual Studio 2012 for Windows 8?

I was looking for a C compiler for Windows 8 and then came to know that I can compile C programs on Visual Studio.

Microsoft offers a walkthrough for the same, but I don't like it since it includes writing program in text editor and use of command prompt frequently, I am looking for more like a Turbo C++ interface.

Is there anyway I can run and compile programs directly in Visual Studio 2012 for windows 8 itself?

Or if that's not possible, what alternatives I have for windows 8?

From the page you posted:

By default, the Visual C++ compiler treats all files that end in .c as C source code, and all files that end in .cpp as C++ source code.

Now create any C++ project type you want and when you add the files, ensure they end in .c and you are done.

Since you asked for alternatives (not clear if you meant even alternative IDEs and/or compilers):

You could try the free Code::Blocks IDE which has support for MINGW , which includes a port of GCC (Gnu Compiler Collections) for Windows. An alternative, and sometimes easier to install, port of GCC based on MINGW is TDM-GCC . Code::Blocks can also be configured to work with other toolchains.

An advantage of using GCC is that it is the default compiler for Linux systems, so if you will happen to code for Linux too, you could "reuse" your knowledge of the GCC compiler you used on Windows.

Another alternative IDE could be eclipse , with its CDT extension , aimed at C/C++ development (can be configured to work with GCC or with many other toolchains). Much heavier than Code::Blocks, but with much more features.

you can use visual studio as TURBO C++

But here

if you want to compile single file

create program.c

file->new->c++file->open

then write c code and save it with extension .c

Now you need to create new project and file->new->project add program.c to this project.

and compile the project By using build->compile . before that change compile as with the

project->properties.

The last time I used Turbo C++ (in the early 90s), it was an IDE just like Visual Studio.

Both Turbo C++ and Visual Studio offer command line tools.

From the start menu, find the Visual Studio tools menu, there should be a command line shortcut there that allows you access to the command line (cl.exe) tools.

If you have makefiles, then you can use nmake rather than make.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM