0

I'm developing a code which uses Easylogging++ as the underlying logging library. Recently, I wanted to update the library since it has some high visibility / high impact bugs and I found out that the library is divided into two files (.cc and .h). This new structure needs inclusion of the .cc file in the build string alongside the main program code.

I'm using Eclipse to develop the project and generate the make files to build the project. I need to tell Eclipse (Oxygen.1) that it needs to compile the .cc file alongside the main file while building the project, however I was unable to do so. Any help is greatly appreciated.

John Bollinger
  • 160,171
  • 8
  • 81
  • 157
bayindirh
  • 425
  • 6
  • 21
  • What does this have to do with the Autotools? – John Bollinger Oct 09 '17 at 20:30
  • Eclipse uses autotools to generate its makefiles automatically at the background IIRC (If that's a wrong tag, I can happily remove it). In other words, I'm trying to make Eclipse to include a `.cc` file in the root compilation command. – bayindirh Oct 09 '17 at 20:36
  • Eclipse *can* use the Autotools, but it only does so for projects that you configure that way. I genuinely like the Autotools, but the only reason to configure an Eclipse project that way is if you import a project into Eclipse that has an existing Autotools-based build system. – John Bollinger Oct 09 '17 at 20:42
  • I started the project as a *Makefile project* years ago. Eclipse is managing and generating the makefiles. Since I'm developing the code for some years, I never had to fiddle with that part until the library's developer fiddled with his code. I *guessed* it was using autotools at the back, but I'm not very knowledgeable at that area honestly. – bayindirh Oct 09 '17 at 20:47
  • A "makefile project" is expressly *not* an Autotools project. Eclipse CDT handles building your makefiles directly in a makefile project. – John Bollinger Oct 09 '17 at 21:25
  • @JohnBollinger Thanks for the heads up. – bayindirh Oct 10 '17 at 06:45

1 Answers1

0

It's easier than I thought. Eclipse's managed build is more intelligent than it seems. Adding many source files under the /src folder causes Eclipse to automatically compile all the files under that folder, unless you exclude them.

This means adding the .h to /lib folder and the .cc file to the /src folder and modifying to .cc to look for the .h file under /lib have solved the problem neatly.

To complete the compilation I had to add some flags, since the developer likes to extensively modify his library between releases.

Everything is working fine again.

bayindirh
  • 425
  • 6
  • 21
  • I have it built successfully just like you. However, did you find out how to get it to built within a single step? I posted my question [here](https://stackoverflow.com/questions/52380156/how-to-build-from-multiple-source-files-at-once-in-eclipse). TIA! – J. Doe Sep 18 '18 at 07:12
  • When you add all the necessary source files, if the whole source tree has a single `main ()` call, it already builds on single step. If you have more than one `main ()` function, you need to create build profiles to build all binaries independently. – bayindirh Sep 27 '18 at 19:18