How to compile a C++ code through another C++ code

Hi,
i want to compile a .cpp file(suppose Test.cpp) living in an other C++ file (Pro.cpp), mean i want to compile Test.cpp indirectly. how i can do so in windows?
Last edited on
i want to compile a .cpp file(suppose Test.cpp) living in an other C++ file (Pro.cpp)

What does it mean for a text file to "live inside" another text file?
i mean, how i can i compile a c++ file using another c++ file ?
you can use it
#include<windows.h>
int main()
{
system("gcc test.cpp");
return 0;
}
hmm, but it doesn't work...
Last edited on
how i can i compile a c++ file using another c++ file ?


You can't. C++ files don't compile things. A C++ file is plain text.
Last edited on
is their any other way to compile it indirectly ?
You could use a makefile.
i don't know the syntax, would you guide me ?
I think you should just compile it directly.
search for make file tutorial . that will compile what ever file you would like to complile
closed account (236Rko23)
u mean to compile a piece of code , that is inside another c++ file as a byte/uint8_t array?
if thats the case then you should first convert the file to a uint8_t array, and embed it in the source file (as when embeding images in teh binary), then write it to the disk and run the compiller.
but you would need Pro.cpp compiled first, and when you run it, it would dump the file from itself to the disk and then run the compiler on it.

if u could give a code example of what u want to do it would be a lot easier as the description u gave is a bit hard to understand
Topic archived. No new replies allowed.