PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Tracing include paths?

This is going to seem like a totally dumb question - but, hey, it's going to annoy me.

I'm playing with porting an app in eVC++, and one file, somewhere, is including winnt.h, which generates the evil looking error

#error Must define a target architecture.

This doesn't happen for every file in a group, it seems to be dependant upon when certain files are included.

Now, in GCC, when an error occurs, a full include path is shown, so that I can figure out which include is causing this problem, however, VC++ doesn't seem to do this. Is there anyway I can switch this on?


I'm not including winnt.h directly, it might be included by a nested include somewhere, but I don't know which one.

Alternatively, has anybody seen this problem elsewhere and has a sensible solution?
I'm using CELIB which might be doing it.

Alternatively, does anybody know how I should get round it? When I define what I think is an appropriate architecture (I did _M_PPC, because there was no MIPS specific one, but that seems to set the same part as an ARM define would - I get a different 'error' (and about 2000 warnings) - which is in a header file.

I'm sure there's some blindingly simple answer to this, but I can't find it, and it's irritating me now, so I thought I might ask before I kill somebody :)
andys · 13 Oct 2002, 13:30 UTC — Tracing include paths?
<snip>

Okay, switching off an option (undefine all thingies) seems to have worked - I had it on to try and protect guarded includes (ie, #ifdef BEOS\n#include "beos.h"), which eVC++ seemed to be including anyway! since it perpetually bitched.

Having done that, it seems to now work okay, at least up to there. Now I have to fix the myriad of other problems it has :)
If you want the full path name of the include file, change the compiler settings for one of your source files and add the /P switch. Compile that file and the compiler will generate a *.i file containing the preprocessor output. Search through the file for "winnt.h" (or whatever include you're looking for) and you'll find the full path of the included file.

EVC has a known problem where it will attempt to see if files exist during the preprocessing pass, even though the file is #ifdef'ed out. If the file doesn't exist then it spews a warning. Note that the preprocessor doesn't open and parse the file, it just checks for its existence. This means you can create a dummy file and throw it into your include path and the warning will go away.
Digby wrote:
If you want the full path name of the include file, change the compiler settings for one of your source files and add the /P switch. Compile that file and the compiler will generate a *.i file containing the preprocessor output. Search through the file for "winnt.h" (or whatever include you're looking for) and you'll find the full path of the included file.


What I more want is I guess the route it took. For example, if you compile something in GCC and there is a problem in the header it will say

In file blah.h:54
(included from blah2.h:232)
(included from....)

you get the picture.

I want to see the route the include took, since I'm never 100% sure.

Fortunately I don't have the same problem anymore


EVC has a known problem where it will attempt to see if files exist during the preprocessing pass, even though the file is #ifdef'ed out. If the file doesn't exist then it spews a warning. Note that the preprocessor doesn't open and parse the file, it just checks for its existence. This means you can create a dummy file and throw it into your include path and the warning will go away.


Good plan. This is a pretty weak thing though. I'm amazed they let a compiler with such an obvious bug through.

Thought I was going mad :)