user101375
user101375

Reputation: 7071

C programming in Visual Studio 2008

Do you know if it's possible to programm c (not c++) in Visual Studio 2008? If yes then how? I haven't found any component for that.

Regards.

Upvotes: 2

Views: 9829

Answers (5)

mathengineer
mathengineer

Reputation: 160

It does not work because C++ precompiled headers, so the solution is select project-properties-c/c++-precompiled headers Then select Not Using Precompiled Headers

Upvotes: 1

Hridaynath
Hridaynath

Reputation: 507

If you want to make a .c program in Visual Studio 2008:

Goto>>File>>New>>Project

Choose "Visual C++" in the left column, then in the right column, select "Win 32 Console Application".

Write file name as:

"Any_Name.c"

Here you can now create a C program:

  • Create source file
  • To compile, press ctrl+shift+B
  • To run, press F5

Upvotes: 1

shoosh
shoosh

Reputation: 78914

Just save the file with .c extension instead of .cpp and it will compile as C instead of C++. To be extra cautious, you can go to the project settings, under "Project -> Properties -> Configuration Properties -> C/C++ -> Advanced", make sure that "Compile As" says "Compile as C code (/TC)".

Upvotes: 14

ASk
ASk

Reputation: 4187

As long as your source file has the .c extension, Microsoft C++ compiler will compile in C-mode.

In addition, the /Tc<source filename> switch can be used to force compilation of a specific file in C mode, and the /TC switch can be used to force C mode for all files. For C++, it's /Tp and /TP respectively.

Upvotes: 6

William Leara
William Leara

Reputation: 10687

You can specify any compiler you'd like in VisualStudio; therefore, if there's a specific C compiler you'd like to use, it will handle it.

Upvotes: 1

Related Questions