0

I am trying to load an existing pool of c++17 sources into an eclipse (2023.03) project. The style of coding is like the following:

#include <string>

class X {
    std::string name;
public:
    X(const std::string &n) : name{n} {}
};

It is compilable with gcc with no warnings. However, eclipse complains about 'name' in the initializer list: *Symbol 'name' could not be resolved".

I tried to add -std=c++17 to every entry with cdt compiler which i could find but it does not help:

  • c/c++->general->preprocessors->providers
  • c/c++->build->discovery.

The issue does not go away. The only way it works if '{n}' are replaced '(n)'. But it means that a lot of code has to change.

What am I missing?

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
Serge
  • 11,616
  • 3
  • 18
  • 28
  • Report the issue at their official site? as this is clearly an eclipse issue. – Jason Mar 31 '23 at 16:15
  • Also see [How to enable C++11/C++0x support in Eclipse CDT?](https://stackoverflow.com/questions/9131763/how-to-enable-c11-c0x-support-in-eclipse-cdt) – Jason Mar 31 '23 at 16:17
  • @Jason I've seen similar suggestions, most of them do not apply. For some reason, there is no 'C/C++ Build -> Settings -> Tool Settings' tab at all. – Serge Mar 31 '23 at 16:32
  • Interesting. I have a fully-custom build and not interested in make files. So, I checked off 'generate makefiles automatically'. This caused disappearance of the 'tool setting' tab in settings :-(. I tried to add the std qual in this mode. However, it still did not help. – Serge Mar 31 '23 at 16:45
  • *there is no 'C/C++ Build -> Settings -> Tool Settings' tab at all.* Is this a makefile project? If so you probably want to head to C/C++ General-> PreProcessor Include Paths, Macros, etc... -> Providers tab -> Built-in compiler settings -> and add `-std=c++17` to the *Command to get compiler specs:* field. – user4581301 Mar 31 '23 at 16:58
  • @user4581301 i did that (in the question). did not work. – Serge Mar 31 '23 at 17:34
  • Is this relevant?: https://stackoverflow.com/questions/66634420/codemr-analyzer-in-eclipse-does-not-work-with-c-c-code/66635804#66635804 – Red.Wave Mar 31 '23 at 19:59
  • @Red.Wave no, it is not relevant. – Serge Mar 31 '23 at 20:05

0 Answers0