how can i get a program to include other cpp files??
like if i was on a tem for school and we spilt the work into smaall parts ca we just use ome kind of include function to put all the files together withotu copy-pasting:????
how can i get a program to include other cpp files??
like if i was on a tem for school and we spilt the work into smaall parts ca we just use ome kind of include function to put all the files together withotu copy-pasting:????
That's usually done by linking multiple object files together.
What normally is done (assuming that only one of the code pieces has a main() ) is to compile each of the sourcefiles into a separate object file and then link them all into one program.
To simplify a compile you can create a makefile to do this, or create a project in IDE's like Visual Studio.
An example using g++
g++ file1.cpp file2.cpp file3.cpp -o myprogram
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.