- Overview
- Building and Running the Demos on Linux and macOS
- Building and Running the Demos on Windows
This directory contains C++ sample programs for various Ice components; they all use the Ice C++98 mapping. These examples are provided to get you started on using a particular Ice feature or coding technique.
Most of the subdirectories here correspond directly to Ice components, such as IceGrid, Glacier2, and so on. We've also included the following additional subdirectory:
- Manual contains complete examples for some of the code snippets in the Ice manual.
The makefiles require GNU make.
On macOS, the command-line demos require the Xcode Command Line Tools (use
xcode-select --install
to install them).
If you install Ice in a non-standard location, you need to set the ICE_HOME
environment variable to the installation directory, for example:
export ICE_HOME=~/testing/ice
Review the settings in ../make/Make.rules
. For example, set OPTIMIZE=yes
to build with optimization.
When you are ready to start the build, run make
, for example:
make V=1
V=1
turns on verbose output.
The clean
and distclean
targets allow you clean all the demos. clean
removes the binary files created by the build; distclean
removes all these
files plus the C++ source files generated by slice2cpp.
Note that make clean
only removes the binary files for the configuration and
platform specified by the CONFIGS
and PLATFORMS
variables in Make.rules
.
You can also build or clean a single demo with make <demo-path>[_clean|_distclean]
,
for example:
make V=1 Ice/hello
make Ice/hello_distclean
Refer to the README.md file in each demo directory for usage instructions.
If you are using Visual Studio 2017, you need to either:
- install the following optional component of the
Desktop development with C++
workload:Windows 8.1 SDK and UCRT SDK
- or retarget the solution to a version of the Windows 10 SDK already installed
(using
Project > Retarget solution
)
Failure to perform this step results in error MSB8036 when building any project:
The Windows SDK version 8.1 was not found. Install the required version of Windows SDK
or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".
Open the solution file C++98 demos.sln
to build the sample programs.
The demos are configured to use Ice C++ binary distribution, packaged with NuGet. The build downloads automatically the Ice NuGet package.
If you have disabled the automatic download of NuGet packages by Visual Studio,
you need to restore the packages before you build using Tools > NuGet Package Manager > Manage NuGet Packages for Solution...
in Visual Studio.
Then select your target configuration (Debug or Release) and platform (Win32
or x64). Right click on the desired demo in the Solution Explorer window and
select Build
.
-
Build from command line:
- Open a Visual Studio command prompt
cd ice-demos\cpp98 MSBuild /p:IceHome=<Ice dist path> /p:Configuration=<Release or Debug> msbuild\ice.proj
Ice dist path
represents a source tree where you built Ice for C++. -
Build from Visual Studio
- Open a Visual Studio command prompt
cd ice-demos\cpp98 MSBuild /p:IceHome=<Ice dist path> /p:Configuration=<Release or Debug> /t:InstallLocalPackages msbuild\ice.proj
The command above creates NuGet packages for the source tree designated by
Ice dist path
(and first builds this source tree if needed), and then installs these NuGet packages in theice-demos\cpp98\packages
folder.- Start Visual Studio, open the
C++98 demos.sln
solution, and select your target configuration (Debug or Release) and platform (Win32 or x64). Right click on the desired demo in the Solution Explorer window and selectBuild
.
You need to add the Ice bin
directory to your PATH before running the demos.
If you are building Debug, add both the Debug and Release bin
directories with a
command similar to:
set PATH=%USERPROFILE%\ice-demos\cpp98\packages\zeroc.ice.v140.3.7.3\build\native\bin\x64\Debug;%USERPROFILE%\ice-demos\cpp98\packages\zeroc.ice.v140.3.7.3\build\native\bin\x64\Release;%PATH%
This is required because the Debug bin
directories provide only a subset of all
Ice services and tools. For example, they don't provide glacier2router
.
If you are building Release, you should add only the Release bin
directory to
your PATH with a command similar to:
set PATH=%USERPROFILE%\ice-demos\cpp98\packages\zeroc.ice.v140.3.7.3\build\native\bin\x64\Release;%PATH%
Then refer to the README.md file in each demo directory for usage instructions.