This repository contains examples demonstrating the use of ACE (ADAPTIVE Communication Environment) framework.
Before building these examples, make sure you have:
-
ACE Library: Install the ACE development library
# On Ubuntu/Debian: sudo apt-get install libace-dev # On RHEL/CentOS/Fedora: sudo yum install ace-devel # or sudo dnf install ace-devel
-
CMake: Version 3.12 or higher
sudo apt-get install cmake
-
C++ Compiler: GCC or Clang with C++11 support
Use the provided build script:
./build.shmkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j$(nproc)mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)A simple example demonstrating ACE Reactor pattern with timer events.
Location: hello_reactor/
Description: Creates a timer that triggers every 2 seconds after an initial 1-second delay.
Run:
cd build
./hello_reactor/hello_reactorOr use the CMake target:
cd build
make run_hello_reactor.
├── CMakeLists.txt # Root CMake configuration
├── build.sh # Build script
├── hello_reactor/ # Hello Reactor example
│ ├── CMakeLists.txt # Example-specific CMake config
│ ├── main.cpp # Source code
│ └── hello_reactor # Pre-compiled binary (reference)
└── README.md # This file
To add a new example:
- Create a new directory for your example
- Add your source files to the directory
- Create a
CMakeLists.txtfile for the example:project(your_example_name) add_executable(your_executable_name main.cpp) target_link_libraries(your_executable_name ACE::ACE pthread )
- Add the subdirectory to the root
CMakeLists.txt:add_subdirectory(your_example_directory)
If you get an error about ACE library not being found:
- Make sure ACE is installed (see Prerequisites)
- Set the
ACE_ROOTenvironment variable if ACE is installed in a custom location:export ACE_ROOT=/path/to/ace - You can also specify the path during CMake configuration:
cmake .. -DACE_ROOT=/path/to/ace
- Ensure you have C++11 support
- Check that all required dependencies are installed
- Try a clean build by removing the
build/directory and rebuilding
These examples are provided for educational purposes.