Header file does not accept set

Hello all!!

I have my header.h file where I have this function declared:
extern std::set<Sense> findtheinfo(char *, int, int, int);

The code was compiling great until I decided to make set the return type of the findtheinfo procedure.

I get 8 errors when compiling:

error C2143: syntax error : missing '{' before ':'
error C2059: syntax error : ':'

and the other 6 are just repetition of the first two. I tried setting the compiler for C++, but again it wont work. (I'm working in Visual Studio 2008)

Thanks!
did you do?
 
#include <set> 
Ah I did it after you reminded me, but that just triggered a series of errors because my header is c and my code is c++. Any ideas on how I can change the header to c++ so that I can include the set?
... because my header is c and my code is c++

As long as your source files have a C++ extension (.cpp, .cxx), the compiler will treat the who unit, header files and all, as C++.

There are such things as C headers, but I don't think that's the issue here.
are you sure this function is supposed to be extern?

Why don't you post the actual error(s) you're getting.
Ok, so Im getting very weird errors now, I have the functions declared and defined, and the compiler doesnt recognize the arguments.


error C2062: type 'char' unexpected
error C2062: type 'int' unexpected

there 86 of these errors, all regarding the parameters of the functions. And the parameters are all in the same order, same data type, everywhere (definition, declaration, usage).

My files are having .c extension, and there is only one file where I need to use c++ library and that is the file I compile with a c++ compiler. Everything else was compiled as c and worked fine till now. But when I decided to merge the code from two files in the one I compile as c++, all these issues appeared.

Thanks for the help!
My files are having .c extension


Well there's your problem.

set is C++. You can't use it in C.
Topic archived. No new replies allowed.