{ "cells": [ { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [ "null\n", "Hello world 1!\n" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "// A basic C++ cell\n", "// define a beaker_main function with an optional parameter for the return value\n", "#include \n", "void beaker_main(){\n", " std::cout << \"Hello world 1!\" << std::endl;\n", " return;\n", "}" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [ "null\n", "Hello world 2!\n" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "// A basic C++ cell\n", "// define a beaker_main function with an optional parameter for the return value\n", "#include \n", "void beaker_main(){\n", " std::cout << \"Hello world 2!\" << std::endl;\n", " return;\n", "}" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [ "null" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "// You can define functions\n", "#include \n", "std::string distant;\n", "void setDistant(){\n", " distant = std::string(\"This is far away\");\n", "}" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false, "deletable": true, "editable": true }, "outputs": [ { "data": { "text/plain": [ "/tmp/beakerx_2ad09f22-01d6-4feb-8bf1-0a10627a1b68775373743641203437/liba922dbe1-89a5-48ba-afcf-73e16126c398.so: undefined symbol: _Z7distantB5cxx11" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "// right now we don't support this functionality (https://github.com/twosigma/beakerx/issues/5228)\n", "// and call functions defined in other C++ cells\n", "#include \n", "#include \n", "extern std::string distant;\n", "extern void setDistant();\n", "\n", "void beaker_main(std::string &ret){\n", " setDistant();\n", " ret = distant;\n", "} " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true, "deletable": true, "editable": true }, "outputs": [], "source": [] } ], "metadata": { "beakerx_kernel_parameters": { "classpath": [], "imports": [ "com.twosigma.beaker.chart.xychart.*", "com.twosigma.beaker.easyform.EasyForm", "com.twosigma.beaker.chart.Filter", "com.twosigma.beaker.chart.Color", "com.twosigma.beaker.NamespaceClient", "com.twosigma.beaker.fileloader.CsvPlotReader", "com.twosigma.beaker.jvm.object.OutputCell", "com.twosigma.beaker.chart.categoryplot.plotitem.*", "com.twosigma.beaker.chart.categoryplot.*", "com.twosigma.beaker.chart.xychart.plotitem.*", "com.twosigma.beaker.table.*", "com.twosigma.beaker.chart.GradientColor", "com.twosigma.beaker.chart.legend.*", "com.twosigma.beaker.chart.histogram.*", "com.twosigma.beaker.chart.heatmap.HeatMap" ] }, "kernelspec": { "display_name": "C++", "language": "cpp", "name": "cpp" }, "language_info": { "codemirror_mode": "C++", "file_extension": ".cpp", "mimetype": "", "name": "cpp", "nbconverter_exporter": "", "pygments_lexer": "", "version": "" } }, "nbformat": 4, "nbformat_minor": 2 }