Explicitly compiling more than one dependent files in Eclipse CDT [message #1774262] |
Thu, 12 October 2017 10:37 |
|
Hello all,
I'm developing a software, which uses Easylogging++ as its logging library. The library was inside a single header before, but its developer divided it into two files (one .h and one .cc), so while compiling it, the .cc file needs to be included in the command line (relevent page is here).
I was able to build the code and work with eclipse while the code was a single header. Currently I cannot build the code since I cannot explicitly define the .cc file to be compiled alongside the file which contains the main().
Is there way to define auxiliary files while compiling the project?
Regards,
Hakan
|
|
|
|
Re: Explicitly compiling more than one dependent files in Eclipse CDT [message #1774337 is a reply to message #1774335] |
Fri, 13 October 2017 06:01 |
|
Hi David,
Thanks for your answer. I've tried your suggestion, and the file is indeed built, however it's built as an independent file. What I need is to include the .cc file in the compilation command of the main application.
In other words, when I copy the file to the /src folder, following happens:
Building file: ../b3f/src/easylogging++.cc
Invoking: GCC C++ Compiler
g++ -std=c++0x -DELPP_THREAD_SAFE -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"b3f/src/easylogging++.d" -MT"b3f/src/easylogging++.o" -o "b3f/src/easylogging++.o" "../b3f/src/easylogging++.cc"
Finished building: ../b3f/src/easylogging++.cc
Building file: ../b3f/src/test_core.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -DELPP_THREAD_SAFE -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"b3f/src/test_core.d" -MT"b3f/src/test_core.o" -o "b3f/src/test_core.o" "../b3f/src/test_core.cpp"
Instead, I need to include the easylogging.cc file in the compilation process of test_core.cpp
Thanks again,
Hakan
|
|
|
|
Re: Explicitly compiling more than one dependent files in Eclipse CDT [message #1774450 is a reply to message #1774422] |
Sat, 14 October 2017 21:50 |
|
Hi David,
Thanks for your reply. You're correct indeed. The problem was elsewhere inside the library. Since I was using the library for a very long time, my codebase utilizes many of the features of Easylogging++. When I've seen "incomplete type" and "forward declaration" errors, I blindly assumed that they're from the compilation process. However, the problem was more sinister.
Easylogging++'s some features are controlled via #defines, and the developer has disabled some of the normally-enabled features, since not many people have used them. I 've added the required flags, and indeed the code is compiling as it should now.
While I'm not inexperienced in C++, I'm somewhat inexperienced in development of a software of this size.
Thanks for all your help. It was enlightening.
Regards,
Hakan
|
|
|
Powered by
FUDForum. Page generated in 0.03361 seconds