"Recompilation"?

I have this code.
1
2
3
4
5
6
7
8
// "something.txt"
std::cout << "Hello!";

// "main.cpp"
int main()
{
#include "something.txt"
}


Then I compile and get an executable file. I then place "something.txt" in the same folder as the program.

I change "something.txt"'s contents.
1
2
3
// "something.txt"
std::cout << "Hello!";
std::cout << "Hello, again!";


After this, I open the program. Is it possible to "recompile" the program without using an IDE like Visual Studio (have it done automatically as the program is opened) to make the edited file show rather than the one which was "compiled into" the program in the beginning?
This makes absolutely no sense whatsoever.
I am a fool. Ignore me.
Last edited on
It makes as much sense as plugins, dynamic libraries and data.
So there is no way to do it in pure C++?
Compiler is a standalone application separate from IDE. Furthermore, there is 'nmake' etc.

The modifiable part could be in an explicitly loaded dynamic library. That makes unload-recompile-reload theoretically possible.

Frameworks like Qt show "load UI definition dynamically from XML data file" kind of functionality sans recompilation.
I don't quite understand. Is LUA able to do such a thing? How would you turn the following:

1
2
// "something.txt"
std::cout << "abc\n";


As a script into:

1
2
3
4
5
6
7
// "main.cpp"
#include <iostream>

int main()
{
#include "something.txt"
}


Without compiling the contents of "something.txt" with the rest of the program in a simple way, using a scripting library (or whatever they're called)?
yes if you include LUA scripts with your program then any changes made to those scripts will be shown without having to recompile, since LUA is typically interpreted
Topic archived. No new replies allowed.