precompiled headers with -iquote not working

View: New views
7 Messages — Rating Filter:   Alert me  

precompiled headers with -iquote not working

by Trigve :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I've problem with precompiled headers when using -iquote. I have structure like
this:

src/stdafx.h
src/stdafx.cpp
Debug/src/stdafx.h

"Debug/src" dir is object ouput dir. "Debug/src/stdafx.h" is dummy file with only
#error inside. "src/stdafx.h" is header which should be precompiled.
"src/stdafx.cpp" has on the first line:
#include "stdafx.h"

I'm compiling "src/stdafx.cpp" like this:
mingw32-g++.exe  -W -O0 -Wmissing-include-dirs -std=c++0x  -iquoteDebug\src
-c src\stdafx.cpp -o Debug\src\stdafx.o

I'm expecting that "Debug/src/stdafx.h" should be included because of -iquote but
"src/stdafx.h" is included instead hence precompiled headers doesn't work either.

Am I doing something wrong?

I'm on Vista 32 bit SP2; mingw: Thread model: win32, gcc version 4.4.1 (TDM-2
mingw32)

Thanks

Trigve


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: precompiled headers with -iquote not working

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 23 October 2009 20:10:32 Trigve wrote:
> I'm expecting that "Debug/src/stdafx.h" should be included because
> of -iquote but "src/stdafx.h" is included instead hence
> precompiled headers doesn't work either.
>
> Am I doing something wrong?

Yes.  Think about this: where does the search path for quoted include
files start?  (Hint: it's always the same, irrespective of your use
of `-iquote', and it isn't shown by `-v').

If you need a further clue: http://mingw.org/wiki/IncludePathHOWTO

--

Regards,
Keith.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: precompiled headers with -iquote not working

by Trigve :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall <keithmarshall@...> writes:
>
> Yes.  Think about this: where does the search path for quoted include
> files start?  (Hint: it's always the same, irrespective of your use
> of `-iquote', and it isn't shown by `-v').
>
> If you need a further clue: http://mingw.org/wiki/IncludePathHOWTO

Thanks for reply.
So it is impossible to use precompiled header that was created in other
directory than original .h files is located in?

Thanks

Trigve





------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: precompiled headers with -iquote not working

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 23 October 2009 21:52:38 Trigve wrote:
> So it is impossible to use precompiled header that was created in
> other directory than original .h files is located in?

Did you study the reference?  It gives you a hint as to what option
you might use to achieve your objective; it isn't `-iquote'.

--

Regards,
Keith.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: precompiled headers with -iquote not working

by Trigve :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall <keithmarshall@...> writes:
>
> Did you study the reference?  It gives you a hint as to what option
> you might use to achieve your objective; it isn't `-iquote'.

I read it once more and couldn't find option that could solve my problem. If I
use "-I" "src/stdafx.h" is picked first. -I- is obsolete and -iquote should be
used instead. Modifying #include path in .src files isn't an option. What other
options I have? If you could give more hints I'll would be very gratefull.

Thanks

Trigve





------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: precompiled headers with -iquote not working

by keithmarshall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 24 October 2009 07:22:12 Trigve wrote:
> > Did you study the reference?  It gives you a hint as to what
> > option you might use to achieve your objective; it isn't
> > `-iquote'.
>
> I read it once more and couldn't find option that could solve my
> problem. If I use "-I" "src/stdafx.h" is picked first. -I- is
> obsolete...

No, it's marked as deprecated; that isn't the same as obsolete.

> and -iquote should be used instead.

You are on the right tack here; in general, `-iquote' may now be
favoured over `-I-'.  However, your problem stems from the fact that
the `-iquote' path implicitly includes the directory containing the
source file for the compiland, *before* any directory you specify
explicitly; `-I-' is the only option documented to defeat that.

> Modifying #include  
> path in .src files isn't an option. What other options I have?

Your best choice is probably to move the header files out of your
`src' directory, into separate directories explicitly reserved for
your headers.  Then you can use distinct paths for production and
debug builds, which will not be automatically selected because they
just happen to coincide with the source file location.

--

Regards,
Keith.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

Re: precompiled headers with -iquote not working

by Trigve :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keith Marshall <keithmarshall@...> writes:
>
> No, it's marked as deprecated; that isn't the same as obsolete.

Sorry, I mean deprecated.
 
> Your best choice is probably to move the header files out of your
> `src' directory, into separate directories explicitly reserved for
> your headers.  Then you can use distinct paths for production and
> debug builds, which will not be automatically selected because they
> just happen to coincide with the source file location.

I've tried it that way and it now works.

Thanks a lot,

Trigve





------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) Thread hijacking
3) HTML/MIME encoded mail
4) Improper quoting
5) Improper trimming
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users