In [7]:
// A basic C++ cell
// define a beaker_main function with an optional parameter for the return value
#include <iostream>
void beaker_main(){
  std::cout << "Hello world 1!" << std::endl;
  return;
}
Out[7]:
null
Hello world 1!
In [3]:
// A basic C++ cell
// define a beaker_main function with an optional parameter for the return value
#include <iostream>
void beaker_main(){
  std::cout << "Hello world 2!" << std::endl;
  return;
}
Out[3]:
null
Hello world 2!
In [5]:
// You can define functions
#include <string>
std::string distant;
void setDistant(){
  distant = std::string("This is far away");
}
Out[5]:
null
In [6]:
// right now we don't support this functionality (https://github.com/twosigma/beakerx/issues/5228)
// and call functions defined in other C++ cells
#include <string>
#include <iostream>
extern std::string distant;
extern void setDistant();

void beaker_main(std::string &ret){
  setDistant();
  ret = distant;
} 
Out[6]:
/tmp/beakerx_2ad09f22-01d6-4feb-8bf1-0a10627a1b68775373743641203437/liba922dbe1-89a5-48ba-afcf-73e16126c398.so: undefined symbol: _Z7distantB5cxx11
In [ ]: