Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse does not build C++ files
Eclipse does not build C++ files [message #1818106] Fri, 06 December 2019 01:24 Go to next message
Eclipse UserFriend
I am trying to compile on Eclipse a project with C and C++ files (.c and .cpp)

I have an error code indicating at linking step that one of my function is not referenced (undefined reference to 'main_application'), and after some investigation I could spot that although I can find it in the project code, all files in .cpp are not compiled, therefore it cannot find their reference.

What I cannot understand is why the g++ compiler is not used for cpp files, while I have it: when I go to my projec properties >> C/C++ build >> ToolCahin Editor, I have as a current toolchain a "GCC 5.3.0 [x86_64-w64-mingw32]", current builder = GNU Make builder, and in the used tools

GCC C++ Compiler 5.3.0 [x86_64-w64-mingw32]
GCC C Compiler 5.3.0 [x86_64-w64-mingw32]
GCC Assembler 5.3.0 [x86_64-w64-mingw32]
GCC C++ Linker 5.3.0 [x86_64-w64-mingw32]
GCC C Linker 5.3.0 [x86_64-w64-mingw32]
GCC Archiver 5.3.0 [x86_64-w64-mingw32]
so I have the C++ compilers, how can I activate them on my c++ files ?

When I build, in the "build" folder (build is my configuration name) I only have the objects (.o) files for .c files, not .cpp files which are never compiled.
Re: Eclipse does not build C++ files [message #1818250 is a reply to message #1818106] Tue, 10 December 2019 17:51 Go to previous message
Eclipse UserFriend
This can happen if you created the project as C only.
You can verify this by looking if the following only has the C compiler.
Project --> Properties --> C/C++ Build --> Settings --> Tool Settings tab


You can try adding another C Nature to the project natures.
Project --> Properties --> Project Natures

In the following example, I made a C-only project with a .cpp file.
The cpp file wouldn't compile until I added the final C-Nature.
index.php/fa/36946/0/

Removing the final C-Nature reverted to the original behavior.

If this doesn't work for you , I don't think there is an easy fix other than recreating the project as both C and C++

[Updated on: Tue, 10 December 2019 17:53] by Moderator

Previous Topic:Modify Makefile for cross compiling with Xenomai
Next Topic: Setting the correct build configuration
Goto Forum:
  


Current Time: Thu Jun 12 12:23:31 EDT 2025

Powered by FUDForum. Page generated in 0.16446 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top