4

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?

Don Corleone
  • 341
  • 2
  • 3
  • 14
  • Visual Studio can be used to write, compile, run and debug the programs the way _Turbo C_ is used. – Rohan Sep 19 '13 at 09:16
  • 1
    Go to `Project Properties` -> `C/C++` -> `Advanced` -> `Compile As` -> `C` – sgarizvi Sep 19 '13 at 09:19
  • 1
    Be aware that Visual Studio has poor C support (stuck at C89). Microsoft itself said the C compiler is just included for backward compatibility, they expect people to use the C++ compiler (partial C++11 support) instead. – Jan Henke Sep 19 '13 at 09:20
  • It's unclear whether you want to know how to compile a `C` program using the the compiler that comes with Visual Studio, or whether you want to learn how to use Visual Studio as an IDE. Others have already ansnwered the former; MSDN answers the latter: [Walkthrough: Creating a Standard C++ Program (C++)](http://msdn.microsoft.com/en-us/library/vstudio/ms235629.aspx). – Nik Bougalis Sep 19 '13 at 09:30

4 Answers4

4

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.

RedX
  • 14,749
  • 1
  • 53
  • 76
  • @NikBougalis What are you missing? – RedX Sep 19 '13 at 09:21
  • It seems to me that he wants to know how to use Visual Studio as an IDE. But I could be wrong. The question is horribly vague. – Nik Bougalis Sep 19 '13 at 09:26
  • Yes, I want to know how to use Visual Studio as an IDE. Sorry for my vague language, I am starting to learn programming and this is perhaps my first question on StackOverflow. – Don Corleone Sep 19 '13 at 19:34
  • @DonCorleone please look at my comment. It shows you how to get started using Visual Studio as a full IDE. – Nik Bougalis Sep 19 '13 at 20:11
1

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.

0

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.
Gangadhar
  • 10,248
  • 3
  • 31
  • 50
0

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.

Neil
  • 11,059
  • 3
  • 31
  • 56