navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

C/C++ Essential Training
Richard Downs

C/C++ Essential Training

with Bill Weinman

 


Widely used for both systems and applications development, the C and C++ programming languages are available for virtually every operating system and are often the best choice for performance-critical applications. In this course, Bill Weinman dissects the anatomy of C and C++, from variables to functions and loops, and explores both the C Standard Library and the C++ Standard Template Library. Features introduced in the C++11 standard (ratified in 2011) are also discussed.

This course serves both as an end-to-end tutorial for those new to the language and a solid reference for experienced C/C++ programmers.
Topics include:
  • Setting up a development environment on Mac, Windows, or Linux
  • Understanding the development cycle
  • Writing statements and expressions
  • Declaring variables and functions
  • Working with arrays and strings
  • Comparing with conditionals
  • Including files and executing macros with the C preprocessor
  • Working with different data types
  • Using operators to perform basic arithmetic and more complicated functions
  • Understanding inheritance
  • C++ template programming
  • Handling system errors and exceptions
  • Using C++ STL containers
  • Using C++11 type inference, Lambda functions, and more

show more

author
Bill Weinman
subject
Developer, Desktop Apps, Programming Languages
software
Eclipse , C , C++
level
Beginner
duration
11h 31m
released
Jun 28, 2012

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Frequently asked questions

Find answers to the most frequently asked questions about C/C++ Essential Training.




Q: On my Mac, after following the instructions in "Upgrading GCC on the Mac," I get an error that says:

    unrecognized command line option "-std=c++11"
A: This means that Eclipse is not invoking the correct version of GCC.

This may be caused by one of two conditions:
1) The hpc-gcc installation is not in the expected location, or
2) The environment variables are incorrect in the Working project settings.

To check the location of the hpc-gcc installation, launch Terminal and type this command:

        ls -l ~/hpc-gcc/

Your result should look something like this:

        $ ls -l ~/hpc-gcc/
        total 0
        drwxr-xr-x  19 billw  staff   646 Jun  7 13:49 bin/
        drwxr-xr-x   7 billw  staff   238 Apr 14 15:15 include/
        drwxr-xr-x  53 billw  staff  1802 Jun  7 13:50 lib/
        drwxr-xr-x   3 billw  staff   102 Mar 17 10:20 libexec/
        drwxr-xr-x   2 billw  staff    68 Jun  7 13:59 share/

If this is not the result you see, follow the instructions again in the first part of the "Upgrading GCC on the Mac" movie to unarchive the compiler and move it into place in your home directory.

 To check that your Working project environment settings are correct follow these steps:

    1. Open Eclipse
    2. In the Project Explorer, select your Working project
    3. Press CMD-I (or Control-click on the Working project) and select "Properties" from the context menu
    4. Expand the C/C++ Build section and select Environment
    5. Check that the Configuration says "Debug [ Active ]"

The Environment variables list should include these entries (they should be highlighted):

        CPATH           ${HOME}/hpc-gcc/include
        LIBRARY_PATH    ${HOME}/hpc-gcc/lib
        PATH            ${HOME}/hpc-gcc/bin:/usr/bin:/bin:/usr/sbin:/sbin

If any of these variables look wrong, you may correct them by selecting an individual variable and pressing the Edit button.

After correcting either of these problems, you should clean the project before trying again. Select Clean from the Project menu, press "Clean all projects," and press the OK button
Q: I am using OS X Snow Leopard (10.6.x) on a Mac. I downloaded the Snow Leopard version of HPC GCC and installed it according to the instructions, but I get this error:

    unrecognized command line option ‘-std=c++11’
A: As of the date of this writing, the Snow Leopard version of hpc-gcc is based on an older version of GCC that does yet support the -std=c++11 switch. Instead, it uses an older version of the -std switch.

In order to use the Snow Leopard version of HPC GCC you will need to change two settings after your installation. Please follow these instructions.

    1. Open Eclipse
    2. In the Project Explorer, select your Working project
    3. Press CMD-I (or Control-click on the Working project) and select "Properties" from the context menu
    4. Expand the C/C++ Build section and select Settings
    5. Under GCC C++ Compiler, select Miscellaneous and change -std=c++11 to -std=c++0x
    5. Under GCC C Compiler, select Miscellaneous and change -std=gnu11 to -std=gnu99

After making these changes, you should be able to follow along with the exercises.
Q: Why is my Working project missing folders for Includes and Debug, and why can't I build my project?
A: This happens if you create a Makefile project instead of a C++ project. You need to delete your Working project and create it again. When you re-create it, be sure to select "C++ Project" from the New Project menu.
Q: Why does Chap07/jump.c use fgets() instead of fgetln()?
A: The fgetln() function is from BSD, so it's not part of the GNU standard library. This means that it works on a Mac but not on Windows or Linux. The fgets() function is the standard way to do this and it works on all modern platforms.
Q:  When setting up the "New CDT Project Wizard" in Eclipse, I don't see a choice for the GCC toolchain (MacOSX GCC on a Mac or MinGW GCC on a Windows PC). What do I need to do?
A:  When setting up the toolchains you need to select "Executable" -> "Empty Project" under "Preferred Toolchains," and when creating a project you need to select "Executable" -> "Empty Project" under "Project type." When the setup movies were recorded, the Executable project type was first in the list. In the latest version of Eclipse it is no longer first in the list, so make sure to select it from the correct spot.

If you select Executable and still don't see the option for your toolchain, or you see it and it's greyed out, you may need to uncheck the box that says "Show project types and toolchains only if they are supported on the platform." This has been know to happen on a Windows PC where MinGW was installed but MS Visual Studio was not installed. If you uncheck this box and are able to select your toolchain, it should still work. This is a bug in Eclipse.

Can’t find an answer?

If you still have a question about C/C++ Essential Training, let us know.

ask a question

Suggested courses to watch next:

Foundations of Programming: Fundamentals (4h 47m)
Simon Allardice

C# Essential Training (6h 44m)
Joe Marini


JavaScript Essential Training (5h 31m)
Simon Allardice

Python 3 Essential Training (6h 36m)
Bill Weinman


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,069 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,024 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked