MSVC 2003 doesn't see any definitions from a nested include file

Posted by ezpresso on Stack Overflow See other posts from Stack Overflow or by ezpresso
Published on 2012-10-18T16:57:42Z Indexed on 2012/10/18 17:00 UTC
Read the original article Hit count: 238

Filed under:
|

I have a piece of code with COM class declaration as follows:

#include "PathTypes.h"

MIDL_INTERFACE("552C7555-0555-4444-BA86-56CF39AAFFFF")
IPathCalc : public IUnknown
{
    virtual HRESULT STDMETHODCALLTYPE GetLocation(
        /* [retval][out] */ GeoLocation* pLoc) = 0;
    virtual HRESULT STDMETHODCALLTYPE SetLocation(
        /* [in] */ GeoLocation* pLoc) = 0;
    ...
    };

Below is the contents of PathTypes.h file:

#if !defined(PATHCALC_TYPES_INCLUDED)
#define PATHCALC_TYPES_INCLUDED

#include "libastro/AstronomyStructs.h"

#endif

And the libastro/AstronomyStructs.h from an external cross-platform library:

#ifndef _ASTRONOMY_STRUCTS_INCLUDED
#define _ASTRONOMY_STRUCTS_INCLUDED

typedef struct {
    double lattitude;
    double longitude;
} GeoLocation;

...

    #endif  /* _ASTRONOMY_STRUCTS_INCLUDED */

When I'm trying to build this code with g++ everything goes well. That's not the case with MSVC 2003 which returns error C2061: syntax error : identifier 'GeoLocation'.

Seems like MSVC doesn't "see" the definitions from the libastro/AstronomyStructs.h file. When I replace #include "PathTypes.h" with #include "libastro/AstronomyStructs.h" the code compiles without errors.

How to make MSVC 2003 to actually "see" the definitions from the nested include files?

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-c++