How do you add a new .c source file in visual c++?
How do you add a new .c source file in visual c++?
Right-click the project & click Add -> New Item
Give it a name with .c at the end...
When you do that the icon to the left of it still says its a cpp source file so whats the difference? Does it even treat it as a .c source file.
If it has a .c extension it should treat it as a C file. There's also a compile option that says "Compile as" and the choices are "C++ code" and "C code".
In my observation VC++ will handle .c files, but it doesn't want to tell you that it can handle .c files.
Although I haven't done any extensive comparisons. I installed VC++ just long enough to determine that for a tutorial I didn't end up putting on my site. For C I use MinGW with Code::Blocks.
Type-ins are back! Visit Cymon's Games at http://www.cymonsgames.com for a new game every week!
I gave .cpp extention to every .c file in the Petzold book in vc++2008 and they all worked.
At least til the half of the book... im only there right now.
Using Windows 10 with Code Blocks and MingW.
For the most part C code will compile just fine under C++ as long as you do explicit typecasting/conversion, which Im pretty sure Petzold does.
I'm also using the Vc++ for c programming.
you should create a file with extension in c separately. then right click on the source folder
choose the add existing.