Hello Garjola:
I have not used C++ source blocks, but I use them frequently with Javascript and Python, and I don't use sessions.
The thing is, for literate programming, we want to include the code from one source block in others, and it would seem that sessions are the solution.
However, I find that for me it is better to use tangle to export the code to source files and then include the tangled files from the other source blocks.
Example:
#+BEGIN_SRC js :tangle src/hello.js
function hello(text) {
console.log("hello " + text);
}
module.exports = hello;
#+END_SRC
First I have to run org-babel-tangle to export all source blocks to files, and then I can include them in other blocks.
#+BEGIN_SRC js
const hello = require("./src/hello.js");
hello("Martin");
#+END_SRC
From what I remember, it is possible to do the same in C++, including the source files you need from the filesystem.
In my opinion, this approach is better than sessions, because the problem with sessions is that you have to make sure the blocks are executed secuentially in the right order to build the "state" that allows you to run your current block. This way each block is independent of all others, worst case you have to run org-babel-tangle to create the required files.
Regards,
Martín