C++ Standard Library
  1. C++ Standard Library
  2. STDCXX-71

[MSVC 8.0] errors on errno in <cerrno>, <errno.h>, and <cstdlib> or <stdlib.h>

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.3
    • Component/s: 19. Diagnostics
    • Labels:
      None
    • Environment:

      MSVC 8

      Description

      From http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200511.mbox/%3c4383A373.5010700@roguewave.com%3e:

      Date: Tue, 22 Nov 2005 16:02:11 -0700
      From: Liviu Nicoara <nicoara@roguewave.com>
      To: stdcxx-dev@incubator.apache.org
      Subject: Compilation error on Windows + MSVC 8.0 in the presence of stdlib headers

      Martin,

      The following error popped up during certification with vc 8.0 on
      Windows 2k3 (all build types):

      $ cat t.cpp
      #include <stdlib.h>
      #include <cerrno>
      int foo = errno;

      The error is:

      $ cl /* various options, includes */ -D_CRT_SECURE_NO_DEPRECATE
      -D_SCL_SECURE_NO_DEPRECATE -nologo -EHsc
      -Zc:wchar_t -MDd -W3 -Zi -GA -GR -c t.cpp

      t.cpp
      c:\build\nicoara\hal\include\ansi\cerrno(77) : error C2039: 'errno' : is
      not a member of '`global namespace''
      c:\build\nicoara\hal\include\ansi\cerrno(77) : error C2873: 'errno' :
      symbol can not be used in a using-declaration
      c:\build\nicoara\hal\source\tools\t.cpp(4) : error C2065: 'errno' :
      undeclared identifier
      NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
      8\VC\BIN\cl.EXE"' : return code '0x2'
      Stop.

      Liviu

        Activity

        Hide
        Martin Sebor added a comment -

        Here's another test case for the same problem involving <errno.h>:

        $ cat t.cpp && nmake t.exe
        #include <stdlib.h>
        #include <errno.h>

        int main ()

        { return errno; }

        Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
        Copyright (C) Microsoft Corporation. All rights reserved.

        cl -D_RWCONFIG=15d_msvc_8_0 -Ic:/contrib/cygwin/build/sebor/dev-hal/include -I./../../../../include -Ic:/contrib/cygwin/build/sebor/dev-hal/tests/stdlib/locale/../include -Ic:/contrib/cygwin/build/sebor/dev-hal/include/ansi -I./../../../.. -Ic:/contrib/cygwin/build/sebor/dev-hal -Ic:/contrib/cygwin/build/sebor/dev-hal/tests/stdlib/locale -I. -nologo -EHsc -Zc:wchar_t -MDd -W3 -Zi -GR -GF -RTC1 -D_CRT_SECURE_NO_DEPRECATE -c t.cpp
        t.cpp
        t.cpp(4) : error C2065: 'errno' : undeclared identifier
        NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 8\VC\BIN\cl.EXE"' : return code '0x2'
        Stop.

        Show
        Martin Sebor added a comment - Here's another test case for the same problem involving <errno.h>: $ cat t.cpp && nmake t.exe #include <stdlib.h> #include <errno.h> int main () { return errno; } Microsoft (R) Program Maintenance Utility Version 8.00.50727.42 Copyright (C) Microsoft Corporation. All rights reserved. cl -D_RWCONFIG=15d_msvc_8_0 -Ic:/contrib/cygwin/build/sebor/dev-hal/include -I./../../../../include -Ic:/contrib/cygwin/build/sebor/dev-hal/tests/stdlib/locale/../include -Ic:/contrib/cygwin/build/sebor/dev-hal/include/ansi -I./../../../.. -Ic:/contrib/cygwin/build/sebor/dev-hal -Ic:/contrib/cygwin/build/sebor/dev-hal/tests/stdlib/locale -I. -nologo -EHsc -Zc:wchar_t -MDd -W3 -Zi -GR -GF -RTC1 -D_CRT_SECURE_NO_DEPRECATE -c t.cpp t.cpp t.cpp(4) : error C2065: 'errno' : undeclared identifier NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 8\VC\BIN\cl.EXE"' : return code '0x2' Stop.
        Hide
        Martin Sebor added a comment -

        Fixed with the referenced change.

        Show
        Martin Sebor added a comment - Fixed with the referenced change.

          People

          • Assignee:
            Martin Sebor
            Reporter:
            Martin Sebor
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development