C/C++Demo (10 Minutes)


This demo shows current C/C++ support in NetBeans. The script will be used during NetBeans Days FY07.

Points to Hit

  • NetBeans is no longer just a Java IDE, it also supports C/C++ and scripting languages
  • C/C++ still very popular, especially for applications which require high throughtput
  • We bring features known for java developers to C/C++ (code completion, navigator, code folding, etc.)
  • The IDE manages the makefile for you
  • Works on various platforms - Solaris, Linux, Windows
  • This is the first release so expect much more to come

Demo Prep

  • Include gcc, gcc-core, gcc-g++, gcc-mingw-core, gcc-mingw-g++, make (all found in the Devel category).
  • Add C:\cygwin\bin path to your system path.


  • "'make' is not recognized as an internal or external command, operable program or batch file." - Make sure cygwin is installed properly.


C/C++ Projects

  • Create a new C/C++ Application project named *CDDemo*. Explain other wizards - dynamic library, static library and makefile.
  • Show the project structure and generated makefile.
  • Create a new Main C++ File named *main* in the folder *demo*.
  • The main class is generated. Mention that the source code was taken from a template user can modify.
  • Type cout << "Hello world"; into the main method.
  • Try to build the project.
  • An error occurs. Jump to the error using the highlighted line. Mention that the line with the error is highlighted.
  • Add include for iostream.h: #include <iostream.h>. Tell them to notice the syntax coloring of the #include.
  • Build the project again, it should be successfull.
  • Run the project and show "Hello World".
  • Run a Batch Build, building both the debug and release configurations.
  • Show the generated CDDemo.exes.
  • Execute one from the command line.


  • Go to project properties.
  • Say that the IDE supports various configurations, by default Debug and Release is available.
  • Go through the list of options and explain them briefly. Emphasize that C/C++ projects are easily configurable using this dialog. Show that you can also add new configurations by clicking on manage configurations.
  • Close the dialog.

Editing/navigation features

  • Say that you will create a new project to show some additional features.
  • Create a new project from Samples / C++ / Applications / HelloApp
  • Show that this application has 3 projects which depend on each other - show the header files which serve as interfaces.
  • Open main.cc from helloapp.
  • Say that you can use hyperlinking - hold the Ctrl key and move over various elements.
  • Click on hello1 to navigate to the header file.
  • Go back and click argc near the bottom of the file to move inside of the current file.
  • Show code folding feature by folding the main method.
  • Type into the main method: cout << "Number of arguments: " << argc-1 << "\n"; and show code completion when typing argc.
  • Show code templates by typing iff<space> and fori<space>. Say how can developers configure additional templates.
  • Show bracket highlighting by moving next to the brackets.
  • Show pair bracket completion by typing foo() { and press enter. The ending } will be filled automatically. Mention that code is formatted, too.
  • Open Window | Class view and say that this is a navigation feature with a logical view of your C/C++ projects. Click on individual methods to navigate.

Working with makefiles (Optional - only if you have time)

  • Open the CDDemo project.
  • Open the makefile from projects view.
  • Show the makefile which was generated by the IDE. Mention you didn't need to write anything by hand. But what if you wanted a different makefile?
  • Open the New File dialog and show the various categories - C, C++, Fortran (should make them laugh), Shell Script and Makefiles.
  • Invoke the Single Executable Makefile wizard.
  • Go through the wizard with defaults, use Browse and choose main.cc as the only source file. Click Next until you reach the Review Makefile page, then click Finish.
  • Show the generated makefile and explain it briefly. Mention the basic targets were generated and the output file is specified. Compiler flags and other variables are set, too, and you can modify them if you need.
  • Run the target by Make Target | Gnu-x86-Windows/a.out


  • Say that !NetBeans supports C/C++ now and users can download the pack from netbeans.org. It's free and works for various versions of !NetBeans. They have to install it extra.
  • Debugging support is not available yet but will be available soon.
  • Mention cnd.netbeans.org as the project homepage with latest news, tutorials, etc. There is a mailing list where people can provide feedback. Bug reports are also welcome.
  • Say that the next generation of Sun Studio will be based on this pack, Sun Studio developers are developing this pack together with !NetBeans developers.
  • The pack supports Sun Studio compilers, Linux compilers and can work on other platforms such as Windows thanks to Cygwin and !MinGW. Mention why people should use Sun compilers (performance matters).
  • We're very excited to support other languages in !NetBeans!

Demo Cleanup

  • Delete the projects you worked with during demo.

-- Main.RomanStrobl - 16 Aug 2006

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo