#34 Error compiling c++ source with bcc32 (Borland C++)

closed-fixed
Mark Hessling
None
5
2005-12-31
2004-02-24
No

When compiling a simple test program test.c, everything is OK. But compiling test.cpp (file contents remains the same) gives the following:
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.cpp:
Error E2132 c:\Bcc55\include\stdlib.h 434: Templates and overloaded operators cannot have C linkage
Error E2040 c:\Bcc55\include\stdlib.h 434: Declaration terminated incorrectly
Error E2316 c:\Bcc55\include\stdlib.h 505: '_argc' is not a member of 'std'
Error E2272 c:\Bcc55\include\stdlib.h 505: Identifier expected
Error E2316 c:\Bcc55\include\stdlib.h 506: '_argv' is not a member of 'std'
Error E2272 c:\Bcc55\include\stdlib.h 506: Identifier expected
Error E2316 c:\Bcc55\include\stdlib.h 603: 'min' is not a member of 'std'
Error E2272 c:\Bcc55\include\stdlib.h 603: Identifier expected
Error E2316 c:\Bcc55\include\stdlib.h 604: 'max' is not a member of 'std'
Error E2272 c:\Bcc55\include\stdlib.h 604: Identifier expected
Error E2190 c:\Bcc55\pdcurses\curses.h 2139: Unexpected }
*** 11 errors in Compile ***

Seems that it happens because stdlib.h is included inside extern "C" { } in case of comipling c++ code. I've tried to move the #include outside extern "C" { } and everything works fine.

Discussion

  • Logged In: YES
    user_id=897166

    Sorry. The latter sentence (about #include <stdlib.h>) is concerning surses.h, or course.

     
  • Logged In: YES
    user_id=897166

    Sorry again :) curses.h, of course.

     
  • Mark Hessling
    Mark Hessling
    2005-06-28

    Logged In: YES
    user_id=86185

    curses.h has been checked into CVS with these changes.

     
  • Mark Hessling
    Mark Hessling
    2005-06-28

    • assigned_to: nobody --> rexx
    • status: open --> pending-fixed
     
    • status: pending-fixed --> closed-fixed