# Latest Ray C++ API example failed to run

**URL:** <https://discuss.ray.io/t/latest-ray-c-api-example-failed-to-run/23105>\
**Category:** Uncategorized\
**Created:** [September 13, 2025, 8:06am UTC](https://discuss.ray.io/t/latest-ray-c-api-example-failed-to-run/23105 "2025-09-13T08:06:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kafka](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@Kafka](https://discuss.ray.io/u/Kafka)\
**Post date:** [September 13, 2025, 8:06am UTC](https://discuss.ray.io/t/latest-ray-c-api-example-failed-to-run/23105/1 "2025-09-13T08:06:19Z")

</div>

Hi，I’m a fresher using Ray Cpp API. I followed some blog steps like:  
**`pip install -U ray[cpp]`  
 `mkdir ray-template && ray cpp --generate-bazel-project-template-to ray-template`**

**`cd ray-template && sh run.sh`**

and failed in runtime.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ray/original/2X/2/2de09dd3592052fedfd1fae0f7035cdda6187435.png)

example.cc ‘s `std::cout << "put_get_result = " << put_get_result << std::endl;`is normally printed out, and then fails.

\*\*I’ve noticed some information here in running cpp example failed，and example codes have written `build --cxxopt=“-D_GLIBCXX_USE_CXX11_ABI=1”` in `.bazelrc` file.\*\*And if I removed **`build --cxxopt=“-D_GLIBCXX_USE_CXX11_ABI=1”`line,I got** `logging.cc:97: Unhandled exception: St9bad_alloc. what(): std::bad_alloc` error also mentioned before. I also noticed that automatically generated libray\_api.so use **`GLIBCXX_USE_CXX11_ABI=1` in the following manner.**  
`nm -C /home/username/workspaceray/ray-template/bazel-bin/_solib_k8/_U_S_S_Cray_Uapi ___Uthirdparty_Slib/libray_api.so | grep -m1 'std::__ cxx11::basic_string' 00000000010fac40 t std:: __cow_string::__ cow_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)`  
**Can anyone can help me solve this runtime problem in latest rayc++?**
