![]() |
After you are done installing HPX, you should be able to build the following
program. It prints Hello HPX World! on the locality
you run it on.
#include <hpx/hpx_init.hpp> #include <hpx/include/iostreams.hpp> int hpx_main(boost::program_options::variables_map&) { // Say hello to the world! hpx::cout << "Hello World!\n" << hpx::flush; return hpx::finalize(); // Initiate shutdown of the runtime system. } int main(int argc, char* argv[]) { // Configure application-specific options. boost::program_options::options_description desc_commandline( "usage: simplest_hello_world [options]"); return hpx::init(desc_commandline, argc, argv); // Initialize and run HPX. }
Copy the text of this program into a file called hello_world.cpp.
Now, in the directory where you put hello_world.cpp, issue the following
commands (where $HPX_LOCATION is the CMAKE_INSTALL_PREFIX
you used while building HPX):
$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HPX_LOCATION/lib/ $ c++ -o hello_world hello_world.cpp `pkg-config --cflags --libs hpx_application` -lhpx_component_iostreams -DHPX_APPLICATION_NAME=hello_world
![]() |
Important |
|---|---|
When using pkg-config with HPX, the pkg-config flags must go after the
|
To test the program, type:
$ ./hello_world
which should print Hello HPX World! and exit.