Compiling pure C under MSVC

Started by
4 comments, last by Codeka 14 years, 5 months ago
I'have some faire knowledge of compiling c++ under MSVC (2008) but I have to create pure c programms for class. I know that there's no difference if I compile my code as c++ (ie. I don't have to change my code), however I don't want to use c++ by accident (or possibly use something I would think is pure C, but isn't). So my question is, what do I need to do in order to compile my projects in pure c under MSVC 2008?
Advertisement
Look through C/C++ project configuration. There's an option for Compile as C code.

That's as close as you'll get, MVC isn't known for strict C (whatever that means today) support, but it's close enough.
well if you right click on the project, go to properties, and look under C/C++->Advanced, you can set the "Compile As" field to "Compile as C Code"

*edit* blast!
Quote:Original post by SiS-Shadowman
I know that there's no difference if I compile my code as c++ (ie. I don't have to change my code)


In general, this is mostly the case, but there are some caveats.
Thanks for the quick answers :). I think those problems are advanced ones that we will (hopefully) never touch in class.
If you just name your files "foo.c" then VC++ will compile them as C by default. Also, I should probably just mention that VC++ is a C89 compiler - it doesn't support many of the newer features from C99 which means a C program written with GCC will often times fail to compile with VC++.

This topic is closed to new replies.

Advertisement