2

I am trying to run my project with new GCC version 11.2.0 and have a problem with dynamic exception specifications error:

mtree.h:669:85: error: ISO C++17 does not allow dynamic exception specifications 669 | void addData(const Data& data, double distance, const mtree* mtree) throw(SplitNodeReplacement) { | ^~~~~

mtree.h:723:98: error: ISO C++17 does not allow dynamic exception specifications 723 | virtual void doRemoveData(const Data& data, double distance, const mtree* mtree) throw (DataNotFound) = 0;

...

I am not good at c++. So, please help me out to resolve this issue. I have changed the default configuration settings(i.e. "cppStandard": "c++17" to "cppStandard": "c++11") but still getting the same issue. error description screenshot

Please refer the link for project code - https://github.com/erdavila/M-Tree

The same code was running in Windows 8.1 and now facing this issue as I updated it to windows 10. Is there a way to fix it?

kiner_shah
  • 3,939
  • 7
  • 23
  • 37
Nimish
  • 21
  • 2
  • 2
    The shown code is using a C++ language feature that has been deprecated and removed in C++17, there's nothing more to it than that. The way to fix it is to remove the throw specification completely, unless it's `throw()`, which is replaced by `noexcept`. The End. – Sam Varshavchik Dec 01 '21 at 03:29
  • setting cpp standard to 11 or 14 should have fixed it. If not, this is a g++ compiler problem. Windows version has nothing to do with it. – Eugene Dec 01 '21 at 03:35
  • @Eugene: I tried to change the cpp standard to 11 and 14 but still it's generating the same error. So, how should I resolve the g++ compiler problem? Any suggestion on it? – Nimish Dec 01 '21 at 03:48
  • @Nimish: "*I tried to change the cpp standard to 11 and 14 but still it's generating the same error.*" That means you failed to properly change this. – Nicol Bolas Dec 01 '21 at 03:52
  • @Nicole I've made the changes to the following files - c_cpp_properties.json - "cppStandard": "c++11" tasks.json - "args": ["--std", "c++11", Settings -> Extensions -> C/C++ -> Cpp default -> C++11 Could you please advise where I am failing exactly? – Nimish Dec 01 '21 at 03:54
  • @SamVarshavchik Thank you so much for providing the exact solution. Actually, I was wondering whether setting a cpp standard to 11 or 14 works? I don't know why it doesn't work this time. Anyways, thanks mate. – Nimish Dec 01 '21 at 04:30

0 Answers0