C++ day 1

I decided I wanted to take a look at C++ yesterday. I took a Java course through UW this summer and, although it was (much much much) more work than I anticipated (semester boiled down to 10 weeks), it was very stimulating; I suppose I’m looking for more, similar, stimulation.

In case (God forbid) something happens to my computer and I need to reinstall the tools I acquired today, or in case I stumble across a newb sort of “IDE installation” question on stackoverflow, I figured I would take some limited notes here.

Based on questions/responses from quora, stackoverflow, other sites, sounds like working with Visual Studio Express 2013 and Cygwin, each in some measure, would give me a well-rounded experience of C++; some writers insist you need some experience working with C++ via command line (hence Cygwin).

First the downloads:

  1. Download Microsoft Visual Studio 2013 here. No special notes on the installation process.
  2. Download Cygwin here.
    1. Some special notes on the Cygwin installation here. Follow these instructions to install some features which (1) do not come with the standard installation and (2) which I understand to be pretty essential (or, rather, working with): g++ comes to mind.
    2. After you complete the installation, you’ll need to add the “bin” directory (which contains those features) to your PCs PATH variable. In my case, the directory was “C:\cygwin\bin”.
      1. Do this via My Computer >> Properties >> Advanced System Settings >> Environment Variables >> Add the directory to the semicolon-delimited list of other directory stores in the variable.

Then, one other thing I found tricky, in a strictly newb way, was navigating to the directory I needed in Cygwin. Tricky for me, only because of my greater familiarity with cmd-Where cd invokes a directory using backslashes, not forward slashes.

Here’s how: (where “boss” is the name of my Windows user and “kingjones” is the name of my computer).

(Note the system test is in italics, user input is in bold italics.)

boss@kingjones ~
$ cd c:/users/boss/documents

boss@kingjones /cygdrive/c/users/boss/documents
$ g++ -o HelloWorld HelloWorld.cpp

boss@kingjones /cygdrive/c/users/boss/documents
$ helloworld
Hello World!

Well, now that I’ve said said “Hello World!” – emphatically, as is conventional (exclamation point!) – it’s time to say goodnight:

int main() {
std::cout << "goodnight." << std::endl;
return 0;
}