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.

6
  • What does this have to do with the Autotools? Commented Oct 9, 2017 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. Commented Oct 9, 2017 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. Commented Oct 9, 2017 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. Commented Oct 9, 2017 at 20:47
  • A "makefile project" is expressly not an Autotools project. Eclipse CDT handles building your makefiles directly in a makefile project. Commented Oct 9, 2017 at 21:25

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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. TIA!
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.