|
Prev: hub
Next: Apple Boot Camp
From: Carl Witthoft on 29 May 2006 20:04 HI -- I'm well experienced in programming under unix, but haven't ever played w/ c++. I have successfully compiled c programs on OSX (using gcc of course). The problem is my child needs to write stuff in c++ for a professor. Her first try crashed, which is to say gcc didn't like it. So: can anyone tell me what I need to set up? Should gcc be able to handle c++, or do I need to set some switches, or download different libraries, etc? Thanks for all advice, URL pointers, etc.
From: Howard S Shubs on 29 May 2006 20:49 In article <carl-09BD7F.20043629052006(a)comcast.dca.giganews.com>, Carl Witthoft <carl(a)witthoft.com> wrote: > Thanks for all advice, URL pointers, etc. Have you installed the developer kit? -- Article II of the impeachment charges against President Nixon was warrantless wiretapping
From: Tom Harrington on 29 May 2006 23:51 In article <carl-09BD7F.20043629052006(a)comcast.dca.giganews.com>, Carl Witthoft <carl(a)witthoft.com> wrote: > HI -- I'm well experienced in programming under unix, but haven't ever > played w/ c++. I have successfully compiled c programs on OSX (using > gcc of course). The problem is my child needs to write stuff in c++ > for a professor. Her first try crashed, which is to say gcc didn't > like it. > So: can anyone tell me what I need to set up? Should gcc be able to > handle c++, or do I need to set some switches, or download different > libraries, etc? Well, I normally don't say it, but since you're someone experienced in programming on Unix, I think "RTFM" might be in order. "man gcc" is a great place to start. This kind of thing is the same on Mac OS X as on any other Unix box. GCC normally uses the filename extension to decide what language is likely to be in the file. File "foo.c" will normally be assumed to be C rather than C++, but "foo.cpp" would be assumed to be C++. There's also "g++", which is just gcc but with the default language set to C++ rather than C. Replace "gcc" with "g++" and you may be set. Finally of course there's gcc's "-x" option, which allows you to specify any supported language you like regardless of anything else. Name your C++ file "foo.java" if you like, and the right "-x" flag will make it work. -- Tom "Tom" Harrington Macaroni, Automated System Maintenance for Mac OS X. Version 2.0: Delocalize, Repair Permissions, lots more. See http://www.atomicbird.com/
From: Dave Seaman on 30 May 2006 07:06 On Mon, 29 May 2006 21:51:43 -0600, Tom Harrington wrote: > In article <carl-09BD7F.20043629052006(a)comcast.dca.giganews.com>, > Carl Witthoft <carl(a)witthoft.com> wrote: >> HI -- I'm well experienced in programming under unix, but haven't ever >> played w/ c++. I have successfully compiled c programs on OSX (using >> gcc of course). The problem is my child needs to write stuff in c++ >> for a professor. Her first try crashed, which is to say gcc didn't >> like it. >> So: can anyone tell me what I need to set up? Should gcc be able to >> handle c++, or do I need to set some switches, or download different >> libraries, etc? > Well, I normally don't say it, but since you're someone experienced in > programming on Unix, I think "RTFM" might be in order. "man gcc" is a > great place to start. This kind of thing is the same on Mac OS X as on > any other Unix box. > GCC normally uses the filename extension to decide what language is > likely to be in the file. File "foo.c" will normally be assumed to be C > rather than C++, but "foo.cpp" would be assumed to be C++. > There's also "g++", which is just gcc but with the default language set > to C++ rather than C. Replace "gcc" with "g++" and you may be set. But note that if you compile and link in separate steps (as you would likely do if using make), then the link step should be performed with g++ in order to get the right libraries. Just depending on the suffix is not going to help you here. It's better to use g++ throughout when compiling and linking C++ code. > Finally of course there's gcc's "-x" option, which allows you to specify > any supported language you like regardless of anything else. Name your > C++ file "foo.java" if you like, and the right "-x" flag will make it > work. -- Dave Seaman U.S. Court of Appeals to review three issues concerning case of Mumia Abu-Jamal. <http://www.mumia2000.org/>
From: Tricheco.net on 30 May 2006 07:56
Try using g++ or manually setting the language to c++. I made this mistake too in the beginning. |