Can you create, edit and compile C code with a C++ IDE? I want to use Visual C++ 2008 Express to create C code. How would I do that?
This is a discussion on Can you create, edit and compile C code with a C++ IDE? within the C Programming forums, part of the General Programming Boards category; Can you create, edit and compile C code with a C++ IDE? I want to use Visual C++ 2008 Express ...
Can you create, edit and compile C code with a C++ IDE? I want to use Visual C++ 2008 Express to create C code. How would I do that?
File->New->Project->Visual C++ node->Empty Project
Then when it creates the project:
right click the folder Sources->Add->New Item->Choose C++ File(but rename it to a .c)
Just realized I am using VS, not VC++, but it should be similar.
Last edited by carrotcake1029; 05-30-2008 at 03:05 PM.
Hey thanks a ton carrotcake1029! I appreciate the help
nerdpirate,
Don't give-up if you can't get it working on the first try! It's usually a pain to download, install, configure, and figure-out a new compiler or IDE. I've used several different compilers, and they've rarely worked on the first-try "out of the box". I'm happy if I can get Hello World working the first day! And, you should always try Hello World (the simplest of all C++ programs) when you are using a compiler/IDE for the first time.
Note - On a Windows system, the operating system will run your program, and then close the window before you have a chance to read "Hello World" on the screen. So, you'll need to add a line or two to the standard Hello World porgram. See this FAQ and this FAQ.
Last edited by DougDbug; 05-30-2008 at 04:39 PM.
There are 3 ways with Visual Studio.
- After creating a new project (or source file), rename them to a .c extension.
- Goto project options, select C/C++ -> Advanced -> Compile as -> set to C.
- Compile your C code as C++ (it works since C++ is backwards compatible), but you may have to add additional casts and avoid reserved keywords.
Second option also works with single source files, but... Take your pick.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^