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 

Compiling C++ (this should be easy.. maybe)

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



Joined: 08 Feb 2006
Posts: 25

PostPosted: Thu Feb 09, 2006 12:35 am    Post subject: Compiling C++ (this should be easy.. maybe) Reply with quote

Hey all, this is my 1st post so, hello, long time lurker 1st time poster etc etc.

I've a question, it's most likely very easy to answer (and probably has been donr before), but seing as I have round about 0 experience using linux or any non-IDE programming (other than a little UnrealScript and GBA stuff), I'm stuck.

All I want to do is compile C++ files instead of C, becuase I'm happier programming C++, I like my classes if nothing else:) I used the forum search but I think it sees it as searching for "C"+""+"" and returns 0 results.

I assume I have to change (or insert) a g++ instead of gcc in the makefile.

Any suggestions? (apologies for being such a newb:p)
Back to top
View user's profile Send private message
nicoli_s



Joined: 02 Jan 2006
Posts: 12

PostPosted: Thu Feb 09, 2006 1:57 am    Post subject: Reply with quote

all I did was name my files .cpp instead of .c and it did it automatically for me
Back to top
View user's profile Send private message Visit poster's website
sandberg



Joined: 05 Oct 2005
Posts: 90
Location: Denmark

PostPosted: Thu Feb 09, 2006 2:14 am    Post subject: Reply with quote

You only have to link with the stdc++ library, no other changes is needed.

So add

Code:

-lstdc++


to the LIBS statement in your makefile.
_________________
Br, Sandberg
Back to top
View user's profile Send private message
fish



Joined: 08 Feb 2006
Posts: 25

PostPosted: Thu Feb 09, 2006 2:21 am    Post subject: Reply with quote

Sorted now, I'd tried renaming to .cpp but it threw up a bunch of errors about undefined functions. Turns out it was working, but I hadn't used

extern "C" { }

around my #includes, but the compiler didn't remind me that the non-standard .h files I'm using aren't c++, my own fault i should have noticed that.

ta for all the help.
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