I would like to do some C development in Windows environment using Visual Studio 2010. There are a few similar questions on this topic, but they are all based on that you are creating a Win32 console application, and a C++ project.
How can I do C development using only .c
and .h
files as I do in Unix? without creating a C++ projects containing tons of files.
It is possible to do C compiling with the cl
compiler from outside of Visual Studio 2010, see Walkthrough: Compiling a C Program. But how can I do this compilation and execution/debugging from inside Visual Studio 2010?
UPDATE
.c
files to it. It works but it creates tons of files..c
and .h
files, use the cl
compiler, and use Visual Studio 2010 as a text editor. And use a command to compile from the text edior, but it seems like I have to compile in a command prompt.Choose C++ File (.cpp), and give it a name like SomeName.c
. Make sure to specify the .c
extension. Add the following code:
int main(int argc, char** argv)
{
return 0;
}
If necessary, disable Microsoft extensions to the C language by right clicking the project and selecting Properties. Select All Configurations at the top of the dialog. Then go to C/C++ → Language → Disable Language Extensions: Yes.
Visual Studio will create the following files for your project. Just get used to having them there. Do not check items with a * into source control.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With