Visual C++.Net: Cannot find 'stdlib.h'?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • PÃ¥l Eilertsen

    Visual C++.Net: Cannot find 'stdlib.h'?

    Hi,

    I have recently installed Visual Studio .Net 2003 and am trying to compile
    and run a simple windows form app (used the VS wizard). When trying to run I
    get an error message telling me: "fatal error C1083: Cannot open include
    file: 'stdlib.h': No such file or directory". I have browsed to C:\Program
    Files\Microsoft Visual Studio .NET 2003\Vc7\includ e and have found the file
    there.

    What can be wrong? I have also tried to uninstall and reinstall.

    Best regards
    PÃ¥l Eilertsen
  • Peter van der Goes

    #2
    Re: Visual C++.Net: Cannot find 'stdlib.h'?


    "Pål Eilertsen" <PlEilertsen@di scussions.micro soft.com> wrote in message
    news:C0D3C094-74E2-4BB9-A50D-1B94030D8BE6@mi crosoft.com...[color=blue]
    > Hi,
    >
    > I have recently installed Visual Studio .Net 2003 and am trying to compile
    > and run a simple windows form app (used the VS wizard). When trying to run[/color]
    I[color=blue]
    > get an error message telling me: "fatal error C1083: Cannot open include
    > file: 'stdlib.h': No such file or directory". I have browsed to C:\Program
    > Files\Microsoft Visual Studio .NET 2003\Vc7\includ e and have found the[/color]
    file[color=blue]
    > there.
    >
    > What can be wrong? I have also tried to uninstall and reinstall.
    >
    > Best regards
    > Pål Eilertsen[/color]

    Visual Studio .NET 2003 (C++) no longer supports many of the old .h headers
    (Visual Studio .NET 2002 did), instead supporting the "new" standard headers
    such as cstdlib. Try #include <cstdlib> in your code in place of #include
    <stdlib.h>.
    Hope this helps.

    --
    Peter [MVP Visual Developer]
    Jack of all trades, master of none.


    Comment

    • Ioannis Vranos

      #3
      Re: Visual C++.Net: Cannot find 'stdlib.h'?

      Peter van der Goes wrote:
      [color=blue]
      > Visual Studio .NET 2003 (C++) no longer supports many of the old .h headers
      > (Visual Studio .NET 2002 did), instead supporting the "new" standard headers
      > such as cstdlib. Try #include <cstdlib> in your code in place of #include
      > <stdlib.h>.
      > Hope this helps.[/color]


      Actually, stdlib.h (and all C90 subset header files) are part of C++98,
      and stdlib.h compiles with VC++ 2003.



      --
      Ioannis Vranos

      Comment

      • PÃ¥l Eilertsen

        #4
        Re: Visual C++.Net: Cannot find 'stdlib.h'?

        I have actually been able to compile now but I had to manually include the
        paths to the files under project properties and additional include and lib
        paths. So for this project I now can compile. But I am left with having to do
        this every time and I don't want to do that. It must be some global variables
        that I can change? I also have problems using third party apps that need the
        compiler. I am i.e. trying to use CMake and get an error that kernel32.lib
        cannot be found. I quess that this is due to the same error, and here there
        are no "additional include path" to adjust. So I am stuck.

        There must be someone that knows the answer to this!!

        PÃ¥l

        "Ioannis Vranos" wrote:
        [color=blue]
        > Peter van der Goes wrote:
        >[color=green]
        > > Visual Studio .NET 2003 (C++) no longer supports many of the old .h headers
        > > (Visual Studio .NET 2002 did), instead supporting the "new" standard headers
        > > such as cstdlib. Try #include <cstdlib> in your code in place of #include
        > > <stdlib.h>.
        > > Hope this helps.[/color]
        >
        >
        > Actually, stdlib.h (and all C90 subset header files) are part of C++98,
        > and stdlib.h compiles with VC++ 2003.
        >
        >
        >
        > --
        > Ioannis Vranos
        >[/color]

        Comment

        • Ronald Laeremans [MSFT]

          #5
          Re: Visual C++.Net: Cannot find 'stdlib.h'?

          Hi,

          Your setup is broken. Can you try to reinstall? These paths are definitely
          on the standard paths on correct installs.

          Ronald Laeremans
          Visual C++ team

          "Pål Eilertsen" <PlEilertsen@di scussions.micro soft.com> wrote in message
          news:F7831E83-FC83-45E1-962F-F221B6484004@mi crosoft.com...[color=blue]
          >I have actually been able to compile now but I had to manually include the
          > paths to the files under project properties and additional include and lib
          > paths. So for this project I now can compile. But I am left with having to
          > do
          > this every time and I don't want to do that. It must be some global
          > variables
          > that I can change? I also have problems using third party apps that need
          > the
          > compiler. I am i.e. trying to use CMake and get an error that kernel32.lib
          > cannot be found. I quess that this is due to the same error, and here
          > there
          > are no "additional include path" to adjust. So I am stuck.
          >
          > There must be someone that knows the answer to this!!
          >
          > Pål
          >
          > "Ioannis Vranos" wrote:
          >[color=green]
          >> Peter van der Goes wrote:
          >>[color=darkred]
          >> > Visual Studio .NET 2003 (C++) no longer supports many of the old .h
          >> > headers
          >> > (Visual Studio .NET 2002 did), instead supporting the "new" standard
          >> > headers
          >> > such as cstdlib. Try #include <cstdlib> in your code in place of
          >> > #include
          >> > <stdlib.h>.
          >> > Hope this helps.[/color]
          >>
          >>
          >> Actually, stdlib.h (and all C90 subset header files) are part of C++98,
          >> and stdlib.h compiles with VC++ 2003.
          >>
          >>
          >>
          >> --
          >> Ioannis Vranos
          >>[/color][/color]


          Comment

          • PÃ¥l Eilertsen

            #6
            Re: Visual C++.Net: Cannot find 'stdlib.h'?

            You know what... I have actually tried to reinstall twice, with no better
            result. Isn't there soem variable that I can change?

            And if I am to try and reinstall what prcautions do I need to take in order
            to get it right? I also have VS 6.0 installed and C++ apps compile nicely
            there.

            Best regrads
            PÃ¥l Eilertsen

            "Ronald Laeremans [MSFT]" wrote:
            [color=blue]
            > Hi,
            >
            > Your setup is broken. Can you try to reinstall? These paths are definitely
            > on the standard paths on correct installs.
            >
            > Ronald Laeremans
            > Visual C++ team
            >
            > "PÃ¥l Eilertsen" <PlEilertsen@di scussions.micro soft.com> wrote in message
            > news:F7831E83-FC83-45E1-962F-F221B6484004@mi crosoft.com...[color=green]
            > >I have actually been able to compile now but I had to manually include the
            > > paths to the files under project properties and additional include and lib
            > > paths. So for this project I now can compile. But I am left with having to
            > > do
            > > this every time and I don't want to do that. It must be some global
            > > variables
            > > that I can change? I also have problems using third party apps that need
            > > the
            > > compiler. I am i.e. trying to use CMake and get an error that kernel32.lib
            > > cannot be found. I quess that this is due to the same error, and here
            > > there
            > > are no "additional include path" to adjust. So I am stuck.
            > >
            > > There must be someone that knows the answer to this!!
            > >
            > > PÃ¥l
            > >
            > > "Ioannis Vranos" wrote:
            > >[color=darkred]
            > >> Peter van der Goes wrote:
            > >>
            > >> > Visual Studio .NET 2003 (C++) no longer supports many of the old .h
            > >> > headers
            > >> > (Visual Studio .NET 2002 did), instead supporting the "new" standard
            > >> > headers
            > >> > such as cstdlib. Try #include <cstdlib> in your code in place of
            > >> > #include
            > >> > <stdlib.h>.
            > >> > Hope this helps.
            > >>
            > >>
            > >> Actually, stdlib.h (and all C90 subset header files) are part of C++98,
            > >> and stdlib.h compiles with VC++ 2003.
            > >>
            > >>
            > >>
            > >> --
            > >> Ioannis Vranos
            > >>[/color][/color]
            >
            >
            >[/color]

            Comment

            • Peter van der Goes

              #7
              Re: Visual C++.Net: Cannot find 'stdlib.h'?


              "Ioannis Vranos" <ivr@guesswh.at .grad.com> wrote in message
              news:%239cuDtwq EHA.592@TK2MSFT NGP11.phx.gbl.. .[color=blue]
              > Peter van der Goes wrote:
              >[color=green]
              > > Visual Studio .NET 2003 (C++) no longer supports many of the old .h[/color][/color]
              headers[color=blue][color=green]
              > > (Visual Studio .NET 2002 did), instead supporting the "new" standard[/color][/color]
              headers[color=blue][color=green]
              > > such as cstdlib. Try #include <cstdlib> in your code in place of[/color][/color]
              #include[color=blue][color=green]
              > > <stdlib.h>.
              > > Hope this helps.[/color]
              >
              >
              > Actually, stdlib.h (and all C90 subset header files) are part of C++98,
              > and stdlib.h compiles with VC++ 2003.
              >
              >
              >
              > --
              > Ioannis Vranos[/color]

              My bad. I was generalizing from the iostream situation.


              Comment

              • Ioannis Vranos

                #8
                Re: Visual C++.Net: Cannot find 'stdlib.h'?

                Peter van der Goes wrote:
                [color=blue]
                > My bad. I was generalizing from the iostream situation.[/color]


                Here is what the standard says about the C subset header files:

                "D.5 Standard C library headers

                For compatibility with the Standard C library, the C++ Standard library
                provides the 18 C headers, as shown in Table 100:

                Table 100—C Headers
                _______________ _______________ _______________ _______________ ______________
                <assert.h> <iso646.h> <setjmp.h> <stdio.h> <wchar.h>
                <ctype.h> <limits.h> <signal.h> <stdlib.h> <wctype.h>
                <errno.h> <locale.h> <stdarg.h> <string.h>
                <float.h> <math.h> <stddef.h> <time.h>
                _______________ _______________ _______________ _______________ ______________

                Every C header, each of which has a name of the form name.h, behaves as
                if each name placed in the Standard library namespace by the
                corresponding cname header is also placed within the namespace scope
                of the namespace std and is followed by an explicit using-declaration
                (7.3.3).


                [Example: The header <cstdlib> provides its declarations and definitions
                within the namespace std.

                The header <stdlib.h> makes these available also in the global
                namespace, much as in the C Standard.
                —end example]"



                So for example the stdio.h header file of a C++ implementation, can be
                implemented like this:


                -- stdio.h example --

                #include <cstdio>

                using std::printf;
                using std::scanf;
                // ...

                -- end of stdio.h --



                --
                Ioannis Vranos

                Comment

                • Matt Osborn

                  #9
                  Re: Visual C++.Net: Cannot find 'stdlib.h'?

                  We use meta projects (projects of projects) that have entirely different
                  directory structures. The only common directory structure is that of the
                  complier and SDK.

                  It would be so convenient if we could change the %lib% and %include% and
                  %path% environments as we switch meta projects.

                  With .NET 2003, we copy versions of "...\Local Settings\Applic ation
                  Data\Microsoft\ VisualStudio\7. 1\VCComponents. dat" to accomplish this. it's
                  too bad we can't save and reuse these through the IDE.

                  "Ronald Laeremans [MSFT]" <ronaldl@online .microsoft.com> wrote in message
                  news:%23fiLI$yq EHA.2888@TK2MSF TNGP14.phx.gbl. ..[color=blue]
                  > Hi,
                  >
                  > Your setup is broken. Can you try to reinstall? These paths are definitely
                  > on the standard paths on correct installs.
                  >
                  > Ronald Laeremans
                  > Visual C++ team
                  >
                  > "Pål Eilertsen" <PlEilertsen@di scussions.micro soft.com> wrote in message
                  > news:F7831E83-FC83-45E1-962F-F221B6484004@mi crosoft.com...[color=green]
                  >>I have actually been able to compile now but I had to manually include the
                  >> paths to the files under project properties and additional include and
                  >> lib
                  >> paths. So for this project I now can compile. But I am left with having
                  >> to do
                  >> this every time and I don't want to do that. It must be some global
                  >> variables
                  >> that I can change? I also have problems using third party apps that need
                  >> the
                  >> compiler. I am i.e. trying to use CMake and get an error that
                  >> kernel32.lib
                  >> cannot be found. I quess that this is due to the same error, and here
                  >> there
                  >> are no "additional include path" to adjust. So I am stuck.
                  >>
                  >> There must be someone that knows the answer to this!!
                  >>
                  >> Pål
                  >>
                  >> "Ioannis Vranos" wrote:
                  >>[color=darkred]
                  >>> Peter van der Goes wrote:
                  >>>
                  >>> > Visual Studio .NET 2003 (C++) no longer supports many of the old .h
                  >>> > headers
                  >>> > (Visual Studio .NET 2002 did), instead supporting the "new" standard
                  >>> > headers
                  >>> > such as cstdlib. Try #include <cstdlib> in your code in place of
                  >>> > #include
                  >>> > <stdlib.h>.
                  >>> > Hope this helps.
                  >>>
                  >>>
                  >>> Actually, stdlib.h (and all C90 subset header files) are part of C++98,
                  >>> and stdlib.h compiles with VC++ 2003.
                  >>>
                  >>>
                  >>>
                  >>> --
                  >>> Ioannis Vranos
                  >>>[/color][/color]
                  >
                  >[/color]


                  Comment

                  • Ronald Laeremans [MSFT]

                    #10
                    Re: Visual C++.Net: Cannot find 'stdlib.h'?

                    Actually you can. If you start up the development environment with the
                    /useenv switch it will just use the environment of the parent (that you
                    could set in e.g. a batch file) and it will pick up all these variables from
                    there.

                    Ronald

                    "Matt Osborn" <mosborn@spam_t rap.TransomaMed ical.com> wrote in message
                    news:OLk07K6qEH A.332@TK2MSFTNG P14.phx.gbl...[color=blue]
                    > We use meta projects (projects of projects) that have entirely different
                    > directory structures. The only common directory structure is that of the
                    > complier and SDK.
                    >
                    > It would be so convenient if we could change the %lib% and %include% and
                    > %path% environments as we switch meta projects.
                    >
                    > With .NET 2003, we copy versions of "...\Local Settings\Applic ation
                    > Data\Microsoft\ VisualStudio\7. 1\VCComponents. dat" to accomplish this. it's
                    > too bad we can't save and reuse these through the IDE.
                    >
                    > "Ronald Laeremans [MSFT]" <ronaldl@online .microsoft.com> wrote in message
                    > news:%23fiLI$yq EHA.2888@TK2MSF TNGP14.phx.gbl. ..[color=green]
                    >> Hi,
                    >>
                    >> Your setup is broken. Can you try to reinstall? These paths are
                    >> definitely on the standard paths on correct installs.
                    >>
                    >> Ronald Laeremans
                    >> Visual C++ team
                    >>
                    >> "Pål Eilertsen" <PlEilertsen@di scussions.micro soft.com> wrote in message
                    >> news:F7831E83-FC83-45E1-962F-F221B6484004@mi crosoft.com...[color=darkred]
                    >>>I have actually been able to compile now but I had to manually include
                    >>>the
                    >>> paths to the files under project properties and additional include and
                    >>> lib
                    >>> paths. So for this project I now can compile. But I am left with having
                    >>> to do
                    >>> this every time and I don't want to do that. It must be some global
                    >>> variables
                    >>> that I can change? I also have problems using third party apps that need
                    >>> the
                    >>> compiler. I am i.e. trying to use CMake and get an error that
                    >>> kernel32.lib
                    >>> cannot be found. I quess that this is due to the same error, and here
                    >>> there
                    >>> are no "additional include path" to adjust. So I am stuck.
                    >>>
                    >>> There must be someone that knows the answer to this!!
                    >>>
                    >>> Pål
                    >>>
                    >>> "Ioannis Vranos" wrote:
                    >>>
                    >>>> Peter van der Goes wrote:
                    >>>>
                    >>>> > Visual Studio .NET 2003 (C++) no longer supports many of the old .h
                    >>>> > headers
                    >>>> > (Visual Studio .NET 2002 did), instead supporting the "new" standard
                    >>>> > headers
                    >>>> > such as cstdlib. Try #include <cstdlib> in your code in place of
                    >>>> > #include
                    >>>> > <stdlib.h>.
                    >>>> > Hope this helps.
                    >>>>
                    >>>>
                    >>>> Actually, stdlib.h (and all C90 subset header files) are part of C++98,
                    >>>> and stdlib.h compiles with VC++ 2003.
                    >>>>
                    >>>>
                    >>>>
                    >>>> --
                    >>>> Ioannis Vranos
                    >>>>[/color]
                    >>
                    >>[/color]
                    >
                    >[/color]


                    Comment

                    • Tarek Madkour [MSFT]

                      #11
                      Re: Visual C++.Net: Cannot find 'stdlib.h'?

                      "=?Utf-8?B?UMOlbCBFaWx lcnRzZW4=?="
                      <PlEilertsen@di scussions.micro soft.com> wrote in
                      news:7C49B240-9490-4B25-A8FB-22F248A62D12@mi crosoft.com:
                      [color=blue]
                      > You know what... I have actually tried to reinstall twice, with no
                      > better result. Isn't there soem variable that I can change?[/color]

                      Take a look at the build log and see which files are passed in the
                      include path to cl.exe. You can set the include paths to use for all
                      solutions from Tools.Options. Make sure the paths you want are there
                      (they should have been there if setup was successful).

                      Thanks,
                      --
                      Tarek Madkour, Visual C++ Team
                      This posting is provided "AS IS" with no warranties, and confers
                      no rights.

                      Comment

                      • Matt Osborn

                        #12
                        Re: Visual C++.Net: Cannot find 'stdlib.h'?

                        Great!

                        I currently run a batch file that sets the environment and then starts Slick
                        Edit. Slick Edit starts the Visual Studio when I want need it so that
                        should work great.

                        Thanks for the tip.

                        "Ronald Laeremans [MSFT]" <ronaldl@online .microsoft.com> wrote in message
                        news:OFNvd%23%2 3qEHA.332@TK2MS FTNGP14.phx.gbl ...[color=blue]
                        > Actually you can. If you start up the development environment with the
                        > /useenv switch it will just use the environment of the parent (that you
                        > could set in e.g. a batch file) and it will pick up all these variables
                        > from there.
                        >
                        > Ronald
                        >
                        > "Matt Osborn" <mosborn@spam_t rap.TransomaMed ical.com> wrote in message
                        > news:OLk07K6qEH A.332@TK2MSFTNG P14.phx.gbl...[color=green]
                        >> We use meta projects (projects of projects) that have entirely different
                        >> directory structures. The only common directory structure is that of the
                        >> complier and SDK.
                        >>
                        >> It would be so convenient if we could change the %lib% and %include% and
                        >> %path% environments as we switch meta projects.
                        >>
                        >> With .NET 2003, we copy versions of "...\Local Settings\Applic ation
                        >> Data\Microsoft\ VisualStudio\7. 1\VCComponents. dat" to accomplish this.
                        >> it's too bad we can't save and reuse these through the IDE.
                        >>
                        >> "Ronald Laeremans [MSFT]" <ronaldl@online .microsoft.com> wrote in message
                        >> news:%23fiLI$yq EHA.2888@TK2MSF TNGP14.phx.gbl. ..[color=darkred]
                        >>> Hi,
                        >>>
                        >>> Your setup is broken. Can you try to reinstall? These paths are
                        >>> definitely on the standard paths on correct installs.
                        >>>
                        >>> Ronald Laeremans
                        >>> Visual C++ team
                        >>>
                        >>> "Pål Eilertsen" <PlEilertsen@di scussions.micro soft.com> wrote in message
                        >>> news:F7831E83-FC83-45E1-962F-F221B6484004@mi crosoft.com...
                        >>>>I have actually been able to compile now but I had to manually include
                        >>>>the
                        >>>> paths to the files under project properties and additional include and
                        >>>> lib
                        >>>> paths. So for this project I now can compile. But I am left with having
                        >>>> to do
                        >>>> this every time and I don't want to do that. It must be some global
                        >>>> variables
                        >>>> that I can change? I also have problems using third party apps that
                        >>>> need the
                        >>>> compiler. I am i.e. trying to use CMake and get an error that
                        >>>> kernel32.lib
                        >>>> cannot be found. I quess that this is due to the same error, and here
                        >>>> there
                        >>>> are no "additional include path" to adjust. So I am stuck.
                        >>>>
                        >>>> There must be someone that knows the answer to this!!
                        >>>>
                        >>>> Pål
                        >>>>
                        >>>> "Ioannis Vranos" wrote:
                        >>>>
                        >>>>> Peter van der Goes wrote:
                        >>>>>
                        >>>>> > Visual Studio .NET 2003 (C++) no longer supports many of the old .h
                        >>>>> > headers
                        >>>>> > (Visual Studio .NET 2002 did), instead supporting the "new" standard
                        >>>>> > headers
                        >>>>> > such as cstdlib. Try #include <cstdlib> in your code in place of
                        >>>>> > #include
                        >>>>> > <stdlib.h>.
                        >>>>> > Hope this helps.
                        >>>>>
                        >>>>>
                        >>>>> Actually, stdlib.h (and all C90 subset header files) are part of
                        >>>>> C++98,
                        >>>>> and stdlib.h compiles with VC++ 2003.
                        >>>>>
                        >>>>>
                        >>>>>
                        >>>>> --
                        >>>>> Ioannis Vranos
                        >>>>>
                        >>>
                        >>>[/color]
                        >>
                        >>[/color]
                        >
                        >[/color]


                        Comment

                        Working...