Jump to content

Recommended Posts

Hey all! After my 2 year discovery period I've decided that computer programming is my calling and have decided to go back to school, to make it official :D. My question is, I've never worked with C++, just web languages. Actually, that was a statement. My real question is, I'm on a macbook, nothing fancy, 2ghz / 2gb ram, and I need a good compiler. I have vmware fusion with an xp pro, and an ubuntu, so I can use GCC or visual c++ or dev c++, but when i run vmware, it rides my cpu hard. Even just using unity kills me. So i guess, other than xcode, is there a good compiler, I dont even need the an IDE, for a mac? Or is there a really light OS that i can run in vmware that'll not hog resources?

 

Thanks ya'll and wish me luck :D

 

:ninja:

 

 

Edit: In before Macs suck. I've recently switched and enjoy it very much so. To each his own, eh?

 

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/167167-solved-college-and-c/
Share on other sites

Like I said I was running Ubuntu in VmWare Fusion, the only problem is that Vm ware is such a resource hog. :(

 

Dual booting is not the same as virtualization. When dual booting, you're not loading one OS within the other, you're loading it instead of the other. It's running native, not wasting resources on emulation or virtualization.

 

But, in response to your question about what would be a good native (to OS X) compiler, I don't know.

Link to comment
https://forums.phpfreaks.com/topic/167167-solved-college-and-c/#findComment-881468
Share on other sites

macs sux n u sux foar ownin one

 

Really?  That's great, good contribution.

 

Ah I see. I hurrily read your post. I have done that before, on i think an xp box, but I've never tried it on os x 10.5.something. Is it possible?

 

Yes, you can dual boot your mac, use bootcamp, comes with 10.5 I believe.

Link to comment
https://forums.phpfreaks.com/topic/167167-solved-college-and-c/#findComment-881548
Share on other sites

lmao. I've read up on it and it looks like bootcamp does the trick. I guess the only problem is, most of the examples warned that some % of the time, often, something corrupts and you have to do a fresh os x install. which would be fine, except i bought this macbook second hand, so i dun believe i have the boot disc... :'(

 

also i'd totally torrent the shit out of it, but after that lady got fined like $2 mil for 20 some songs, and my buddy got caught for seeding some shit by his isp, i'm a little hesitant.

 

that lady link, prolly old news by now -> http://thesheikhdown.wordpress.com/2009/06/19/woman-pays-80000-per-song-dollars-on-24-illegally-dled-songs/

 

:\

Link to comment
https://forums.phpfreaks.com/topic/167167-solved-college-and-c/#findComment-881637
Share on other sites

Ok so googling got me somewhere (imagine that). It turns out GCC is packed with the Xcode dev tools on the mac.

 

So using smultron I made my first ever c++ file... saved it. Using terminal I moved to the correct dir, and used

 

gcc -o program hello.cpp

 

which gave me :(

 


Joshs-Mac:Endeavors MacBook$ cd C++
Joshs-Mac:C++ MacBook$ gcc -o prgram hello.cpp
Undefined symbols:
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in cctFw5cc.o
  "std::ios_base::Init::~Init()", referenced from:
      ___tcf_0 in cctFw5cc.o
  "std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
      _main in cctFw5cc.o
  "std::ios_base::Init::Init()", referenced from:
      __static_initialization_and_destruction_0(int, int)in cctFw5cc.o
  "std::cout", referenced from:
      __ZSt4cout$non_lazy_ptr in cctFw5cc.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

 

what i guess would be a compile error!

for this:

 


// Fig. 2.1: fig02_01.cpp
// Text-printing program.
#include <iostream> // allows program to output data to the screen

// function main begins program execution
int main(){

std::cout << "Hello World!\n"; // display message

return 0; // indicate that program ended successfully

} // end function main

 

any thoughts? I realize this has just become a 'different languages question', but i figured I'd give ya'll some closure. Plus I don't doubt that everyone of you has (successfully) ran the hello world cpp program...

 

knowing the few things i do about c++... not much... i guess maybe the iostream file is perhaps not included in the xcode pack? but i thought iostream is the most basic.. so i dunno

 

:suicide:

 

Link to comment
https://forums.phpfreaks.com/topic/167167-solved-college-and-c/#findComment-881690
Share on other sites

First, I'd like to state that I've never tried using the Xcode toolkit before, nor have I ever tried developing software on a Mac.  Everything I mention is from what I found in a brief search of the Apple Developer site (http://developer.apple.com/)

 

Right off the bat, I can explain why it is that your code won't compile.  It's always best to start with the first error and work from there, so you've got that line about "Undefined symbols".  That means that the compiler was unable to find the symbols file to compile from.  You only referenced the iostream header, so I'd try including the stdlib.h header as well.  See if that compiles.

 

"iostream" is used for input and output data streams, so it's useful in displaying the "Hello World!" to the screen.  "stdlib.h" contains many of the general functions of C++.  It's just typically a good idea to include both of these for any basic C++ project until you've got your feet under you.

 

As for IDEs, I've used Eclipse (http://www.eclipse.org/) with the CDT plugin (http://www.eclipse.org/cdt/) and Visual Studio myself.  The latter won't run on a Mac without some sort of Windows virtualization, but Eclipse can be installed on a Mac and configured to use the GCC compiler.  Apparently it's slightly different for Macs in the sense that you have to decide whether to make use of the Cocoa platform (which actually uses another language called Objective C) or Carbon (allows you to use C++).  You can pick your poison from http://www.eclipse.org/downloads/.  Make sure to configure Eclipse to know where your GCC compiler is located at, or you'll run into problems quickly once you start trying to use that platform.

 

If you do go with the virtualization route, you can download a free version of the Visual Studio C++ IDE from http://www.microsoft.com/express/vc/ which will include the proprietary Microsoft VC++ compiler.  There are some small differences between how you'll need to write your code for GCC or VS, mainly because Microsoft includes several of their own unique functions in their standard library.

 

I don't know if you're learning from a book or website, but I'd definitely recommend looking at http://www.cplusplus.com/doc/tutorial/ for a tutorial and information about learning C++.  I used it when I first learned the language and still do for all the reference material on the STL.  Good luck!

Link to comment
https://forums.phpfreaks.com/topic/167167-solved-college-and-c/#findComment-881710
Share on other sites

I wouldn't learn Visual C++ for the simple reason that, like captbeagle said, it has some proprietary kinks that make it more difficult to learn.  Memory management can be difficult enough without throwing a specialized form of heap management on top of it.  Stick with the standard until you know what you're doing.

Link to comment
https://forums.phpfreaks.com/topic/167167-solved-college-and-c/#findComment-881867
Share on other sites

@captbeagle - Awesome, thanks for the sources and info. I'm trying to read thru 2 books (structure and interpretation of computer programs, and c++, how to program) before my classes start in a month, just to be on top of things. That cplusplus link looks great!

 

@Nightslyr - I agree 100%. I'd rather learn the foundation before learning any derivatives.

 

Thanks to all, and wish me luck!

 

:ninja:

 

Edit: solved, unless anyone else wants to get in here and drop some c++ infos! If thats the case, it'd be greatly appreciated, and the thread can prolly be unsolved :)

 

Thanks again guys!

Link to comment
https://forums.phpfreaks.com/topic/167167-solved-college-and-c/#findComment-881921
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.