Thread: writing c on ms visual c++ 2003

  1. #1
    essence of digital xddxogm3's Avatar
    Join Date
    Sep 2003
    Posts
    589

    writing c on ms visual c++ 2003

    can you write fully functional c code on the ms visual c++ 2003 compiler?
    work just gave me a new laptop and need to write c for a class.
    my work has restricted all installs and downloads.
    "Hence to fight and conquer in all your battles is not supreme excellence;
    supreme excellence consists in breaking the enemy's resistance without fighting."
    Art of War Sun Tzu

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    So long as you name your files as prog.c, it should compile them as C.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, certainly. The Microsoft C++ compiler is also able to compile as "plain C". As Salem says, if the filename is "xxxx.c", then the file will be compiled as "C" rather than "C++".

    If you are using the command-line "cl" command to build your code, you can also use the /TC or /TP to "force" the compiler to C or C++ mode respectively. The same applies in the IDE - you can set the /TC or /TP flag for either all files or individual files by right-clicking in the solution explorer, then Properties->C/C++->Advanced. The most common use of this is if somone has suppied some C++ code in files called .c (or .C from a Unix environment - which isn't differentiated in Windows from the .c variation).

    --
    Mats

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  2. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  3. header file bringing errors?
    By bluehead in forum Windows Programming
    Replies: 4
    Last Post: 08-19-2003, 12:51 PM
  4. Visual Age C++ to MS VC++ conversion issues?
    By Ruchikar in forum Windows Programming
    Replies: 3
    Last Post: 08-10-2003, 09:54 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM