Thread: MS VC++: can i limit it so i cant use any c++?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    1

    MS VC++: can i limit it so i cant use any c++?

    Is there any way to change the settings of VC++ so it compiles only in C, nothing about c++ is allowed in my assignment? this would help a lot!

  2. #2
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    dun think so, writing the code in c and compile with a c compiler

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    6
    Try encapsulating the function prototypes in your .h file with...

    Code:
    #ifdef  __cplusplus
    extern "C" {
    #endif
    
    int myFunc(char *myString);
    /* more prototypes here */
    
    #ifdef __cplusplus
    }
    #endif
    I'd suggest looking up "__cplusplus" or "extern "C"" in the help files that come with MSVC++ just in case. This is from some relatively old code that a friend of mine wrote and I think it may be MSVC++ specific.

  4. #4
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    naming the file with a .c extention not a .cpp should work.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  5. #5
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Or you can use the /TC compiler option to compile all files as C regardless of the extension.

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    16
    no_one has the right idea,

    create a new text file and immediately rename it with a .c extension, create a new workspace ( I've only ever used the Simple Console Application setting!) and paste the .c file in the code window and start coding.

    The /TC thing sounds great, but us newbies need to be told how to do it and also how to change it back if we ever 'graduate' to C++ programs!


    Cheers,

    foffo

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Speed test result
    By audinue in forum C Programming
    Replies: 4
    Last Post: 07-07-2008, 05:18 AM
  2. Difference in MSVC 6 & MS VC .Net
    By passionate_guy in forum C Programming
    Replies: 1
    Last Post: 01-23-2006, 06:39 AM
  3. Ping
    By ZakkWylde969 in forum Tech Board
    Replies: 5
    Last Post: 09-23-2003, 12:28 PM
  4. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 04:57 PM
  5. hi need help with credit limit program
    By vaio256 in forum C++ Programming
    Replies: 4
    Last Post: 04-01-2003, 12:23 AM