| View previous topic :: View next topic |
| Author |
Message |
fish
Joined: 08 Feb 2006 Posts: 25
|
Posted: Thu Feb 09, 2006 12:35 am Post subject: Compiling C++ (this should be easy.. maybe) |
|
|
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 |
|
 |
nicoli_s
Joined: 02 Jan 2006 Posts: 12
|
Posted: Thu Feb 09, 2006 1:57 am Post subject: |
|
|
| all I did was name my files .cpp instead of .c and it did it automatically for me |
|
| Back to top |
|
 |
sandberg
Joined: 05 Oct 2005 Posts: 90 Location: Denmark
|
Posted: Thu Feb 09, 2006 2:14 am Post subject: |
|
|
You only have to link with the stdc++ library, no other changes is needed.
So add
to the LIBS statement in your makefile. _________________ Br, Sandberg |
|
| Back to top |
|
 |
fish
Joined: 08 Feb 2006 Posts: 25
|
Posted: Thu Feb 09, 2006 2:21 am Post subject: |
|
|
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 |
|
 |
|