Can you create, edit and compile C code with a C++ IDE?

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 ...

  1. #1
    Registered User nerdpirate's Avatar
    Join Date
    May 2008
    Location
    Provo, UT
    Posts
    2

    Can you create, edit and compile C code with a C++ IDE?

    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?

  2. #2
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    398
    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.

  3. #3
    Registered User nerdpirate's Avatar
    Join Date
    May 2008
    Location
    Provo, UT
    Posts
    2
    Hey thanks a ton carrotcake1029! I appreciate the help

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    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.

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,170
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating an Edit Box (Subclassing)
    By csonx_p in forum Windows Programming
    Replies: 9
    Last Post: 05-05-2008, 06:36 AM
  2. DLL question
    By cboard_member in forum Game Programming
    Replies: 1
    Last Post: 04-24-2006, 02:19 AM
  3. Sigmaze! -- Second Attempt.
    By quzah in forum Contests Board
    Replies: 42
    Last Post: 11-09-2004, 05:45 PM
  4. Code will not compile - code from a book!
    By Chubz in forum C++ Programming
    Replies: 19
    Last Post: 09-12-2004, 10:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21