CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    Compile error including <set>

    hi all,

    I´m using a std::set in a simple aplication in VC6.0. I´m not using MFC neither precompiled headers. The problem is that the compile complains when I include <set> the error is c:\program files\microsoft visual studio\vc98\include\functional(16) : error C2143: syntax error : missing '{' before '<'
    c:\program files\microsoft visual studio\vc98\include\functional(16) : error C2059: syntax error : '<'
    that repeat several times. The first time is on the line 16 that has:
    Code:
    _STD_BEGIN
    // TEMPLATE STRUCT unary_function
    template<class _A, class _R>                   //<=====that is the line 16.
    	struct unary_function {
    	typedef _A argument_type;
    	typedef _R result_type;
    	};
    ...
    It occurs on file functional.h that is an include of set.h. I´m gessing that the compiler is not recognizing the template but I verified on the compiler options and I haven´t found a compiler parameter to set it. How to fix it??

    thank you in advance.

  2. #2
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    6,205

    Re: Compile error including <set>

    Quote Originally Posted by Rabelo
    How to fix it??
    While the compiler is taking you to the standard library header, the greatest likelyhood is that something is wrong with your declaration of the std::set object, and / or usage of the same.

    So, please post that code.

  3. #3
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    Re: Compile error including <set>

    That is the funny part. I just included the set. I commented the set declaration and the error persist. if I comment the #include <set>, the program compile ok.

  4. #4
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    6,205

    Re: Compile error including <set>

    Can you post a small prototype sample that reproduces the bug.

    This -
    Code:
    #include <set>
    
    int main(int argc, char* argv&#091;&#093;)
    {
      return 0;
    }
    ...Compiles just fine.

    Additionally, check if you have the latest Service Pack for MSVC 6.0 installed.

  5. #5
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    Re: Compile error including <set>

    At the beggining of the program:
    Code:
    #include <set>
    #define _TESTEC_C_
    #include <windows.h>
    #include "calcpoints.h"
    .....
    And I don´t declare any class of type std::set. The error occurs inside the include (#include <set>) and them the compiler stops the compilation with: fatal error C1003: error count exceeds 100; stopping compilation inside the include. I made a small test using the set and it compiled ok. It is specific of these aplication. May be a compiler parameter or something like that. Is there any compiler parameter that can be causing these errors?

  6. #6
    Join Date
    Oct 2002
    Location
    Germany
    Posts
    6,205

    Re: Compile error including <set>

    There isn't a compiler parameter to help you.

    Unless you post a prototype that reproduces this error, telling anything is akin to shooting in the dark.

    Anyways, try this shot -
    Code:
    #define _TESTEC_C_
    #include <windows.h>
    #include "calcpoints.h"
    #include <set>
    BTW, I hope the #define is not intending to be a multiple inclusion guard. If it is so, it isn't playing that role.

  7. #7
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Compile error including <set>

    Quote Originally Posted by Rabelo
    At the beggining of the program:
    Code:
    #include <set>
    #define _TESTEC_C_
    #include <windows.h>
    #include "calcpoints.h"
    .....
    And I don´t declare any class of type std::set. The error occurs inside the include (#include <set>) and them the compiler stops the compilation with: fatal error C1003: error count exceeds 100; stopping compilation inside the include. I made a small test using the set and it compiled ok. It is specific of these aplication. May be a compiler parameter or something like that. Is there any compiler parameter that can be causing these errors?
    Can you post your project (excluding the debug and release folder) here?

  8. #8
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725

    Re: Compile error including <set>

    uhh, what is the extension of your file ?

    c

    or

    cpp

    ???

  9. #9
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    335

    Re: Compile error including <set>

    I can´t belive!!!! It was .c ..... I am working on a third party project and this detail wasn´t noticed...
    Thank you !

  10. #10
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Compile error including <set>

    Wow....good catch Philip...didn't even think so far...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured