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 

Compiler error? Ambiguous types

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



Joined: 29 Jun 2008
Posts: 20
Location: Singapore

PostPosted: Fri Oct 24, 2008 12:55 am    Post subject: Compiler error? Ambiguous types Reply with quote

Hi all,
I'm trying to port over a game engine, and it compiles fine as a library, but when I try out the sample code, i get the error:

Code:
psp-g++ -I-I -I../../include/ -I. -I/usr/local/pspdev/psp/sdk/include -G0  -O2 -I-I -I../../include/ -I. -I/usr/local/pspdev/psp/sdk/include -G0  -O2 -fno-exceptions -fno-rtti -D_PSP_FW_VERSION=390   -c -o main.o main.cpp
In file included from /usr/local/pspdev/psp/sdk/include/pspuser.h:18,
                 from /usr/local/pspdev/psp/sdk/include/pspkernel.h:18,
                 from main.cpp:79:
/usr/local/pspdev/psp/sdk/include/psptypes.h:68: error: reference to ‘u8’ is ambiguous
/usr/local/pspdev/psp/sdk/include/psptypes.h:39: error: candidates are: typedef uint8_t u8


Any ideas?


Last edited by asphodeli on Fri Oct 24, 2008 7:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
Onii



Joined: 05 Oct 2008
Posts: 40

PostPosted: Fri Oct 24, 2008 9:45 am    Post subject: Reply with quote

Sounds like u8 is defined more than once. Check all your includes for definitions of u8.

Odd though that it only shows one candidate. Are you using any other high level libraries that might define u8 like psptypes.h does?

Another thing I notice is this is a cpp file. Are the others that compile also cpp or just c?
Back to top
View user's profile Send private message
asphodeli



Joined: 29 Jun 2008
Posts: 20
Location: Singapore

PostPosted: Fri Oct 24, 2008 7:47 pm    Post subject: Reply with quote

Everything else is in cpp (if you're talking about just the sample code with the compiled library) , and yes I am using a custom defined typedef that is provided by the game engine. My output from psp-g++ is listed on http://pastebin.com/m1c4fa721 for brevity's sake
Back to top
View user's profile Send private message
Onii



Joined: 05 Oct 2008
Posts: 40

PostPosted: Sat Oct 25, 2008 8:00 am    Post subject: Reply with quote

psptypes.h defines a u8 typedef. If your library also defines one, you'll need to comment one or the other out (or wrap them in #ifdefs) so that you only have one definition.

EDIT: Or of course, if it's defined in a class use Class::u8. same if you are "using Namespace;"
Back to top
View user's profile Send private message
asphodeli



Joined: 29 Jun 2008
Posts: 20
Location: Singapore

PostPosted: Sat Oct 25, 2008 9:57 am    Post subject: Reply with quote

Onii wrote:
psptypes.h defines a u8 typedef. If your library also defines one, you'll need to comment one or the other out (or wrap them in #ifdefs) so that you only have one definition.

EDIT: Or of course, if it's defined in a class use Class::u8. same if you are "using Namespace;"


Well, the strange thing is that my custom u8 is inside a namespace, and somehow it conflicts with psptypes.h:

Code:

namespace TestEngine
{
typedef unsigned char      u8;
}
Back to top
View user's profile Send private message
Onii



Joined: 05 Oct 2008
Posts: 40

PostPosted: Sat Oct 25, 2008 10:05 am    Post subject: Reply with quote

Yes, and you are likely doing "using TestEngine;", therefore colliding your name space with global.

Just qualify your declarations with TestEngine::u8 var; and you'll be fine.
Back to top
View user's profile Send private message
asphodeli



Joined: 29 Jun 2008
Posts: 20
Location: Singapore

PostPosted: Sat Oct 25, 2008 10:17 am    Post subject: Reply with quote

Onii wrote:
Yes, and you are likely doing "using TestEngine;", therefore colliding your name space with global.

Just qualify your declarations with TestEngine::u8 var; and you'll be fine.


Whoa...thats alot of work...if its the only way then there isn't much choice, but the code compiles fine on the linux version of gcc with no complaints, so I asked the question. :)
Back to top
View user's profile Send private message
Onii



Joined: 05 Oct 2008
Posts: 40

PostPosted: Sat Oct 25, 2008 10:37 am    Post subject: Reply with quote

Or you can comment the declaration out of psptypes.h.

EDIT: of course.... that's a whole other can of worms :)

EDIT: global search and replace, with confirmation is your friend :)
Back to top
View user's profile Send private message
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