CS253

This file defines the header for each page. An optional "icon" image (I use the textbook):

Replace this with info about this class:

CS253: Problem Solving with C++

Spring 2014

How I Compile

Links to the various pages for this class:

Wish I could do this: * Schedule

How I Compile C++ Programs

I don’t use an IDE, like Eclipse. I work from the command line. I use vim to edit, and g++ to compile. You may edit and compile your programs however you like—I just expect you to turn in a .cc file. How you produce it is your affair.

I generally compile C++ programs like this:

g++ -Wall -Wextra -ansi -pedantic -Werror -Wfatal-errors foo.cc

“But that’s too hard to type every time!”

You don’t have to type it every time. Type it once, and use shell history (!g) to do it again. Or, you could write a two-line bash script.

However, when I get really serious, as in a Makefile:

g++ -g -Wall -Wextra -ansi -pedantic -Werror -Wfatal-errors -Winit-self -Wshadow -Wlogical-op -Wcomment -Wctor-dtor-privacy -Wold-style-cast -D_GLIBCXX_DEBUG -fno-diagnostics-show-option -fmessage-length=$COLUMNS foo.cc

“But that’s ridiculous! I shouldn’t have to type all that.”

Yeah, you shouldn’t—it’s terribly unfair. If life were fair, then the compiler would do all that by default, and ice cream would be good for you. Get over it. I don’t type it all every time—I copy it.

Also, I compile an important program with more than one compiler. Different compilers generate different warnings. clang++ works well on Linux.

More warnings? Why on earth would I want more wanings!?”

I wish you the best of luck with your career in the fast-food industry.

Modified: 2014-01-24T09:29

User: Guest

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building