.c in vc++

This is a discussion on .c in vc++ within the Windows Programming forums, part of the Platform Specific Boards category; How do you add a new .c source file in visual c++?...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    127

    .c in vc++

    How do you add a new .c source file in visual c++?

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Right-click the project & click Add -> New Item
    Give it a name with .c at the end...

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    127
    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.

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    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".

  5. #5
    Registered User guesst's Avatar
    Join Date
    Feb 2008
    Location
    Lehi, UT
    Posts
    179
    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!

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    765
    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.
    Compiler MSVC++ 2010 with Code::Blocks.

  7. #7
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    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.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  8. #8
    Just a Human Anuradh_a's Avatar
    Join Date
    Jan 2008
    Posts
    50
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. .h file vs .c file
    By RocketMan in forum C Programming
    Replies: 5
    Last Post: 05-13-2008, 07:28 PM
  2. functions in .C file not recognized in .CPP file
    By tooKool4School6 in forum C++ Programming
    Replies: 1
    Last Post: 06-02-2006, 10:30 AM
  3. makefile exported by vc 6.0 doesn't work
    By wow in forum Windows Programming
    Replies: 7
    Last Post: 03-24-2006, 03:20 PM
  4. filename pattern matching
    By dwks in forum C Programming
    Replies: 11
    Last Post: 07-13-2005, 10:23 AM
  5. globals & multiple .c files
    By Unregistered in forum C Programming
    Replies: 8
    Last Post: 10-30-2002, 08:43 PM

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