0
Code::Blocks multiple files C++
So I want to make a data file and connect it to my main file. I have a huge amount of data that I need to pre-place in my code and I do not want it at the tope of my code because my code will be quite long to. Is there any way to seperate my code into two files and connect them? I have already tried #include "data.c" to connect it to my "main.cpp" file and it is not working. It keeps coming up with error: ld returned 1 exit status.
1 ответ
0
To separate your code into multiple files and connect them in a C++ project using Code::Blocks, you need to follow these steps:
- Create a header file
- Create a source file
- Include header file
- Implement function
- Build configuration
- Finally build and compile the code
Make sure that all three files (data.h, data.cpp, and main.cpp) are included in your Code::Blocks project and that you've properly configured the build settings.
https://sololearn.com/compiler-playground/caQSK71SltC6/?ref=app
https://sololearn.com/compiler-playground/c7KJYr3M4qhJ/?ref=app
https://sololearn.com/compiler-playground/c9g5ayk5D8t0/?ref=app