compile and run c++ code runtime

后端 未结 2 961
南方客
南方客 2021-01-25 15:26

Does anyone know how to compile your c++ code wich you write while your program is already running?

And later i would like to run that code.

I want to do this be

2条回答
  •  -上瘾入骨i
    2021-01-25 16:16

    You'd have an easier time if you chose a language that was designed with embedding in mind - like LUA or python. For C++, you'd have to go for something extremely clumsy and fragile like invoking an external compiler (which is also a logistics nightmare when shipping your game), or something as complex as integrating a compiler in your game (probably doable with llvm components, but...)

    Also, for "teaching programming", C++ probably isn't the best language :)

提交回复
热议问题