forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

-I and -iquote

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
RustyFunkNut



Joined: 26 Sep 2005
Posts: 17
Location: London, UK

PostPosted: Wed Sep 28, 2005 3:26 am    Post subject: -I and -iquote Reply with quote

I've been having problems porting over an old project of mine to compile on the PSP. I tracked down one source of errors to parts of the STL which include <debug/debug.h> pulling in a file with that path/name in my project's root directory.

As I reference all my local headers using #include "" rather than #include <>, I tried using -I- in my Makefile to get around this like so:

Code:

INCDIR = ./Source -


(which expands to -I./Source -I-). Unfortunately in gcc 3.4.4 -I- is deprecated and -iquote<path> is recommended instead. The only way around this I could find was by making this change to /psp/sdk/lib/build.mak:

Code:

33c33
< CFLAGS   := $(addprefix -I,$(INCDIR)) $(CFLAGS)
---
> CFLAGS   := $(addprefix -iquote,$(LOCALINCDIR)) $(addprefix -I,$(INCDIR)) $(CFLAGS)


So basically I replace INCDIR with LOCALINCDIR in my Makefile, and everything works perfectly.

Hopefully this will be useful for anyone else struggling with similar issues. Is there any chance this change might be incorporated into a later version of the pspsdk?

Paul
Back to top
View user's profile Send private message MSN Messenger
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Wed Sep 28, 2005 5:03 am    Post subject: Reply with quote

Why can't you just do:
Code:
CFLAGS = -iquote foo
in your own Makefile? Your CFLAGS come after the ones specified in build.mak, which is identical to your first example.
Back to top
View user's profile Send private message
RustyFunkNut



Joined: 26 Sep 2005
Posts: 17
Location: London, UK

PostPosted: Wed Sep 28, 2005 10:46 am    Post subject: Reply with quote

Good point...I'd not thought of that. I guess I was looking for a permanent solution rather than a quick fix. I'm happy to do this, but I thought it was something that could catch other people out. That and I like the idea of 'system' and 'local' includes being treated differently (it irks me when people do #include <localfile.h>, because I'm a pedant :))

Another thing I noticed was that the CFLAGS options get included in the CXXFLAGS and ASFLAGS options twice (in many of the samples at least). E.g. when I speicified:

Code:

INCDIR = ./Blah -
CFLAGS = -O -G0 -Wall -DBLAH


I see this compile error with Foo.cpp:

Code:

psp-g++  -I./Blah -I- -I. -I/usr/local/pspdev/psp/sdk/include -O -G0 -Wall -DBLAH  -I./Blah -I- -I. -I/usr/local/pspdev/psp/sdk/include -O -G0 -Wall -DBLAH -fno-exceptions -fno-rtti   -c -o Source/Foo.o Source/Foo.cpp
cc1plus: note: obsolete option -I- used, please use -iquote instead
cc1plus: error: -I- specified twice


Because $(CFLAGS) is concatenated to CXXFLAGS in both the Makefile and build.mak. It's not really a problem, but it doesn't seem like what was intended.

It's a minor issue anyway, I'm just glad my code is compiling :)
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group