Thread: why wont MS Visual C++ understand my #include <stdlib.h>

  1. #1
    Registered User Master_Rondal's Avatar
    Join Date
    Oct 2002
    Posts
    9

    Question why wont MS Visual C++ understand my #include <stdlib.h>

    I use MS MS Visual C++ and save with the extension .c when I program in C...I want to use the exit() function and MS Visual C++ wont understand my #include <stdlib.h>...WTF!!!


  2. #2
    Registered User mlupo's Avatar
    Join Date
    Oct 2001
    Posts
    72
    Care to post the code? I'll try it in my MS Visual C.
    Mike
    NEVER PET YOUR DOG WHILE IT'S ON FIRE!

  3. #3
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    Check to see if the file stdlib.h is really there in the 'include' folder. And check for a probable typo in your code where you are including this file name.

  4. #4
    Registered User Master_Rondal's Avatar
    Join Date
    Oct 2002
    Posts
    9
    i checked for typos and used an exit(1);

    the code was

    #include <stdio.h>
    #include <stdlib.h>

    main()
    {

    //rest of code goes here

    exit(1);

    return 0;

    }


    AND IT DIDNT WORK

    the rest of the code is length but my errors came from the stdlib.h
    and it said exit was not a function...because of the stdlib.h not being valid

  5. #5
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    So, what errors do you get if you compile something simple like this (paste them here):
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    int main(void)
    {
        exit (1);
        return 0;
    }
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  6. #6
    Registered User Master_Rondal's Avatar
    Join Date
    Oct 2002
    Posts
    9
    well well

    i recompiled my old program and it worked!!!
    guess it was an OS error...i am using windows after all...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Heapsort
    By xENGINEERx in forum C Programming
    Replies: 2
    Last Post: 03-30-2008, 07:17 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. header file bringing errors?
    By bluehead in forum Windows Programming
    Replies: 4
    Last Post: 08-19-2003, 12:51 PM