Current Status

Book

Program Phases, A Programming Language and API Translator allows programmers to learn new programming languages by providing simple indexed example programs. Each program illustrates useful, common, and well defined functionality.

C++ wxWidgets - Multi-Platform
Console Based Hello World! with Strings

Program Phase 1-16 C++ wxWidgets
Windows Code Setup and Compilation
Windows Code Setup and Compilation Steps
  1. Start the Visual C++ 2008 Express Edition program.

  2. VC++ EE - Activate Menu Item: File --> New --> Project
    • For the "Project type", select "Win32" and then select the "Win32 Console Application" template. Enter pp1_16 as the project "Name". Enter the appropriate folder as the project "Location". Make sure that the "Create directory for solution" check box is not checked. Activate the "OK" button to proceed with the "Win32 Application Wizard".

  3. Activate the "Next" button of the "Win32 Application Wizard".

  4. Verify that a "Console Application" is selected and also check the "Empty project" check box. Activate the "Finish" button of the "Win32 Application Wizard".

  5. VC++ EE - Activate Menu Item: Project --> Add New Item
    • On the "Add New Item" dialog window, select the "Visual C++ --> Code" category and then select the "C++ File" template. Enter pp1_16.cpp for the file "Name" and then activate the "Add" button. Enter the source code for the pp1_16.cpp file.

  6. VC++ EE - Activate Menu Item: Build --> Configuration Manager
    • Select "Release" or "Debug" for the "Active solution configuration".
  7. VC++ EE - Activate Menu Item: Project --> pp1_16 Properties
    Enter the following settings:
    Configuration Properties --> General --> Character Set
    For ANSI Configuration
    • "Use Multi-Byte Character Set"
    For Unicode Configuration
    • "Use Unicode Character Set"
    This setting (ANSI or Unicode) needs to match the setting specified when the wxWidgets library was compiled. Configuration Properties --> C/C++ --> General --> Additional Include Directories
    • "$(wxwin)\lib\vc_lib\msw";"$(wxwin)\include"
    Configuration Properties --> C/C++ --> Preprocessor --> Processor Definitions
    For Release Configuration
    • WIN32;__WXMSW__;_CONSOLE;NOPCH
    For Debug Configuration
    • WIN32;__WXMSW__;__WXDEBUG__;_CONSOLE;NOPCH
    This setting (Release or Debug) needs to match the setting specified when the wxWidgets library was compiled.

  8. Continue entering settings on the "pp1_16 Property Pages" window.
    Configuration Properties --> C/C++ --> Code Generation --> Runtime Library
    For Release Configuration
    • Multi-threaded (/MT) or Multi-threaded DLL (/MD)
    For Debug Configuration
    • Multi-threaded Debug /MTd or Multi-threaded Debug DLL (/MDd)
    This setting (Release or Debug) needs to match the setting specified when the wxWidgets library was compiled. Configuration Properties --> Linker --> General --> Additional Library Directories
    • "$(wxwin)\lib\vc_lib"

    Configuration Properties --> Linker --> Input --> Additional Dependencies
    For Release Configuration
    • wxmsw28_core.lib wxbase28.lib
    For Debug Configuration
    • wxmsw28d_core.lib wxbase28d.lib
    The name of the library files is dependent on the version of wxWidgets installed. Substitute the appropriate version number in the file name to match the version of the wxWidgets library installed on your computer. This setting (Release or Debug) needs to match the setting specified when the wxWidgets library was compiled. Configuration Properties --> Linker --> System --> SubSystem
    • Console (/SUBSYSTEM:CONSOLE)
  9. Close the "pp1_16 Property Pages" window by activating the "OK" button.

  10. VC++ EE - Activate Menu Item: Build --> Build pp1_16
    After the build is successful, a compiled file called pp1_16.exe will be found in either the Release or Debug folder of the pp1_16 folder.
 

Windows Command Prompt Compilation
  1. From a Visual Studio 2008 command prompt, change directories to the pp1_16 folder and then enter one of the following commands on a single line:
    For Release Configuration:
    • cl.exe /I "C:\Program Files\Microsoft SDK's\Windows\v6.0A\Include" /I "c:\wxWidgets-2.8.6\lib\vc_lib\msw" /I "c:\wxWidgets-2.8.6\include" /D "WIN32" /D "__WXMSW__" /D "_CONSOLE" /MT /Fo"Release\\" /EHsc /c pp1_16.cpp
    For Debug Configuration:
    • cl.exe /I "C:\Program Files\Microsoft SDK's\Windows\v6.0A\Include" /I "c:\wxWidgets-2.8.6\lib\vc_lib\msw" /I "c:\wxWidgets-2.8.6\include" /D "WIN32" /D "__WXMSW__" /D "__WXDEBUG__" /D "_CONSOLE" /MTd /Fo"Debug\\" /EHsc /c pp1_16.cpp
    Substitute the appropriate name for the library files that match the version of the wxWidgets library and platform SDK installed. The Runtime Library switch (/MT, MTd, /MD, /MDd) needs to match the setting used to compile the wxWidgets source code.
  2. Run the linker to create the pp1_16.exe file from the pp1_16.obj file.

  3. For Release Configuration:
    • link.exe /OUT:"Release\pp1_16.exe" /INCREMENTAL:NO /LIBPATH:"c:\wxWidgets-2.8.6\lib\vc_lib" /LIBPATH:"C:\Program Files\Microsoft SDK's\Windows\v6.0A\Lib" /SUBSYSTEM:CONSOLE wxmsw28_core.lib wxbase28.lib user32.lib advapi32.lib shell32.lib ole32.lib .\release\pp1_16.obj
    For Debug Configuration:
    • link.exe /OUT:"Debug\pp1_16.exe" /INCREMENTAL:NO /LIBPATH:"c:\wxWidgets-2.8.6\lib\vc_lib" /LIBPATH:"C:\Program Files\Microsoft SDK's\Windows\v6.0A\Lib" /SUBSYSTEM:CONSOLE wxmsw28d_core.lib wxbase28d.lib user32.lib advapi32.lib shell32.lib ole32.lib .\debug\pp1_16.obj
    Substitute the appropriate name for the path and library files that match the version of the wxWidgets library and platform SDK installed. Each of the preceding commands should be entered on a single line.
 
 
 

Program Phase 1-16 C++ wxWidgets
Linux Code Setup and Compilation
Linux Code Setup and Compilation Steps
  1. Update the LD_LIBRARY_PATH variable and then start the KDevelop program.
    • export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH kdevelop &

  2. KDevelop - Activate Menu Item: Project --> New Project
    • Select the "C++ --> Simple Hello world program" template. Set the "Application name" to pp1_16. Set the "Location" to the appropriate folder. Activate the "Next" button four times and then activate the "Finish" button.

  3. KDevelop - Activate Menu Item: Project --> Build Configuration --> debug

  4. Enter the source code for the pp1_16.cpp file. Replace any existing code in the file.

  5. Before compiling the pp1_16.cpp source code file, additional settings for accessing the wxWidgets library need to be entered into the KDevelop project. From a terminal window, enter the following:
    For Release Configuration:
    • wx-config --unicode=no --debug=no --static=yes --cxxflags > cxxresults.txt
  6. For Debug Configuration:
    • wx-config --unicode=no --debug=yes --static=yes --cxxflags > cxxresults.txt

  7. Next, run this command:
    For Release Configuration:
    • wx-config --unicode=no --debug=no --static=yes --libs > libresults.txt
  8. For Debug Configuration:
    • wx-config --unicode=no --debug=yes --static=yes --libs > libresults.txt

  9. KDevelop - Activate Menu Item: Project --> Project Options
    • Click on the "Configure Options" item on the left pane. Select the "debug" configuration. Click on the "C++" tab. Here you will see the "Compiler flags" text box. The results of running the wx-config utility stored in the cxxresults.txt file must be copied and pasted here. Be sure to preserve the -O0 -g3 flags. Next, click on the "General" tab and paste the contents of the libresults.txt file in the "Linker flags" text box. You may be prompted to "Re-run configure". Select the "Do Not Run" button.
  10. KDevelop - Activate Menu Item: Build --> Run automake and friends
  11. KDevelop - Activate Menu Item: Build --> Run Configure
  12. KDevelop - Activate Menu Item: Build --> Build Project
    • If a message is displayed concerning no Makefile, activate the "Run Them" button.
 

Linux Command Prompt Compilation
  • The following commands can be used to compile the pp1_16.cpp file:
    For Release Configuration:
    • g++ pp1_16.cpp `wx-config --unicode=no --debug=no --static=yes --libs` `wx-config --unicode=no --debug=no --static=yes --cxxflags` -o pp1_16
    For Debug Configuration:
    • g++ pp1_16.cpp `wx-config --unicode=no --debug=yes --static=yes --libs` `wx-config --unicode=no --debug=yes --static=yes --cxxflags` -o pp1_16
    The preceding commands should be entered on a single line inside the source code folder (pp1_16/src). The command line settings need to match the settings specified when the wxWidgets library was compiled.
 
 
 

Program Phase 1-16 C++ wxWidgets
Mac OS X Code Setup and Compilation
  • Mac OS X code setup and compilation steps can be found here.