#import Directive collision problem , error C2061

I think I have a collision problem :
I have two intefaces defined in a idl called Car and Garage.
in Garage Two properties are defined :
1
2
HRESULT Cars([out, retval] Cars** prop);
HRESULT CarsForUser([in] Well well, [out, retval] Cars** prop);


then in tlh :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Garage : IDispatch
{
    //
    // Property data
    //
    __declspec(property(get=GetCars))
    CarsPtr Cars;
    __declspec(property(get=GetCarsForUser))
    CarsPtr CarsForUser[];
   
    //
    // Wrapper methods for error-handling
    //
    CarsPtr GetCars ( );
    CarsPtr GetTrendsForUser (
        struct Well * Well );

    //
    // Raw methods provided by interface
    //

      virtual HRESULT __stdcall get_Cars (
        /*[out,retval]*/ struct Cars * * prop ) = 0;
      virtual HRESULT __stdcall get_CarsForUser (
        /*[in]*/ struct Well * Well,
        /*[out,retval]*/ struct Cars * * prop ) = 0;



finally in my .h I have the following code :
1
2
  STDMETHOD(get_Cars)(Cars* * prop);
	STDMETHOD(get_CarsForSource)(Well * well,Cars * * prop); // error 
here

I get: error C2061: syntax error : identifier 'Cars'

I guess the problem is that I have a duplicate definition of "Cars":
one in my interface
and the second to the generated code in tlh:
1
2
3
4
5
 //
    // Property data
    //
    __declspec(property(get=GetCars))
    CarsPtr Cars;



I tryed
rename("Cars","CarsX")
without getting what I want.


2 questions :

1- am I right? is it the problem?
2- is there a solution to fix this case ?

thanks a lot!
Last edited on
http://www.cplusplus.com/forum/articles/1624/
Can you please modify your post to have proper code-tags.

The error you have listed is typical when you have failed to include the header file with the definition of Cars.
sorry I didn't know about the formating.

Error is really this denerated code with same name as my interface. I tried by renaming my interfaces from idl and everything goes fine. But I can't change these name now due to specifications...

Topic archived. No new replies allowed.