Taylor's Blog

Atypical ramblings

Seeing C++

My first class at OSU doesn’t begin for another month, so I have started reading the textbook for my first class in the meantime. It’s CS161 – Introduction to Computer Science I. The textbook is Starting Out with C++: Early Objects. It’s my first time learning C++ and it has been a little more difficult to get started with than, say, Python.

For starters, getting an IDE up and running to compile and run C++ code has is not very straight-forward. Often I read that the recommended starting point for C++ is Visual Studio and it is much different from IDEs I have used in the past. With Python, you can just download the latest version and write and run a .py file using the included IDE. But with VS it’s no so easy. It seems to be that:

  • VS is optimized for huge projects, not single-file programs
  • VS student has a command prompt that you can use to run single-file programs, but you need to optimize it with special flags like cl /EHsc /nologo /W4 myProgram.cpp
  • You can also run a C++ program straight from the command line in Unix, again with special flags like g++ -std=c++14 -Wall -Wextra myProgram.cpp -o myProgram.exe
  • You can write a simple batch script to include those code lines and make it easier to run a C++ file
  • In SublimeText (and possibly Notepad++) you can build and run single cpp files very easily, provided that you manage to set up the command line compiler on Windows.
  • Here is an online C++ compiler you can use if you do not need any 3rd party libraries or disc access
  • Some simpler IDEs might be CodeBlocks, CodeLite, and BloodShed
  • Steve recommends Cywgwin and VIM. He says that if I’m not using Visual Studio on Windows, my best be is to just go on Linux. The only languages that work really well on Windows are Python and C#.
Updated: August 27, 2015 — 1:07 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

Taylor's Blog © 2015