Eclipse CDT syntax error but still compiles












1















I've installed the latest MinGW (8.1.0) and have tested with Eclipse Neon and Photon



#include <iostream>
#include <unordered_map>

int main(){
std::unordered_map<int,std::string> dict = {{1,"one"},{2,"two"}};
dict.insert({3,"three"});
for(const auto& p: dict){std::cout << p.first << " = " << p.second << std::endl;}
}


it compiles fine, but the insert method is underlined red.



Eclipse gives the error: 'insert' is ambiguous



is there any way to update the eclipse indexer or something?



EDIT:

casting an argument to const removes the syntax error



dict.insert(std::pair<const int,std::string>{3,"three"});


EDIT 2:

or you can use MinGW (5.1.0) with C++11 dialect



EDIT 3:
Eclipse Photon R
GCC 7.3.0



EDIT 4:
CDT 9.5.5 for Photon (19th Nov 2018)



Eclipse 4.6 (Neon 2016) is no longer supported. (CDT 9.2)

Eclipse 4.8 (Photon 2018) is no longer supported. (CDT 9.5)

Eclipse 4.9 (2019) is now on the rise, starting with CDT 9.6.










share|improve this question





























    1















    I've installed the latest MinGW (8.1.0) and have tested with Eclipse Neon and Photon



    #include <iostream>
    #include <unordered_map>

    int main(){
    std::unordered_map<int,std::string> dict = {{1,"one"},{2,"two"}};
    dict.insert({3,"three"});
    for(const auto& p: dict){std::cout << p.first << " = " << p.second << std::endl;}
    }


    it compiles fine, but the insert method is underlined red.



    Eclipse gives the error: 'insert' is ambiguous



    is there any way to update the eclipse indexer or something?



    EDIT:

    casting an argument to const removes the syntax error



    dict.insert(std::pair<const int,std::string>{3,"three"});


    EDIT 2:

    or you can use MinGW (5.1.0) with C++11 dialect



    EDIT 3:
    Eclipse Photon R
    GCC 7.3.0



    EDIT 4:
    CDT 9.5.5 for Photon (19th Nov 2018)



    Eclipse 4.6 (Neon 2016) is no longer supported. (CDT 9.2)

    Eclipse 4.8 (Photon 2018) is no longer supported. (CDT 9.5)

    Eclipse 4.9 (2019) is now on the rise, starting with CDT 9.6.










    share|improve this question



























      1












      1








      1








      I've installed the latest MinGW (8.1.0) and have tested with Eclipse Neon and Photon



      #include <iostream>
      #include <unordered_map>

      int main(){
      std::unordered_map<int,std::string> dict = {{1,"one"},{2,"two"}};
      dict.insert({3,"three"});
      for(const auto& p: dict){std::cout << p.first << " = " << p.second << std::endl;}
      }


      it compiles fine, but the insert method is underlined red.



      Eclipse gives the error: 'insert' is ambiguous



      is there any way to update the eclipse indexer or something?



      EDIT:

      casting an argument to const removes the syntax error



      dict.insert(std::pair<const int,std::string>{3,"three"});


      EDIT 2:

      or you can use MinGW (5.1.0) with C++11 dialect



      EDIT 3:
      Eclipse Photon R
      GCC 7.3.0



      EDIT 4:
      CDT 9.5.5 for Photon (19th Nov 2018)



      Eclipse 4.6 (Neon 2016) is no longer supported. (CDT 9.2)

      Eclipse 4.8 (Photon 2018) is no longer supported. (CDT 9.5)

      Eclipse 4.9 (2019) is now on the rise, starting with CDT 9.6.










      share|improve this question
















      I've installed the latest MinGW (8.1.0) and have tested with Eclipse Neon and Photon



      #include <iostream>
      #include <unordered_map>

      int main(){
      std::unordered_map<int,std::string> dict = {{1,"one"},{2,"two"}};
      dict.insert({3,"three"});
      for(const auto& p: dict){std::cout << p.first << " = " << p.second << std::endl;}
      }


      it compiles fine, but the insert method is underlined red.



      Eclipse gives the error: 'insert' is ambiguous



      is there any way to update the eclipse indexer or something?



      EDIT:

      casting an argument to const removes the syntax error



      dict.insert(std::pair<const int,std::string>{3,"three"});


      EDIT 2:

      or you can use MinGW (5.1.0) with C++11 dialect



      EDIT 3:
      Eclipse Photon R
      GCC 7.3.0



      EDIT 4:
      CDT 9.5.5 for Photon (19th Nov 2018)



      Eclipse 4.6 (Neon 2016) is no longer supported. (CDT 9.2)

      Eclipse 4.8 (Photon 2018) is no longer supported. (CDT 9.5)

      Eclipse 4.9 (2019) is now on the rise, starting with CDT 9.6.







      c++ eclipse-cdt






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 18:43







      Puddle

















      asked Nov 16 '18 at 2:37









      PuddlePuddle

      426318




      426318
























          1 Answer
          1






          active

          oldest

          votes


















          3














          This is an issue affecting GCC 8 standard library headers, tracked in Eclipse bug 540957. It was fixed for CDT 9.6 (released as part of Eclipse 2018-12).



          UPDATE: The bug was also fixed for CDT 9.5.5, which is planned for an out-of-band release on 2018-11-19. If you're running Eclipse Photon or later, Help -> Check for Updates should pick up this update once it's out.



          A workaround until then is to use GCC 7 or earlier.






          share|improve this answer


























          • thanks for the insight. for now i've found out i can just cast the argument to const dict.insert(std::pair<const int, std::string>{3, "three"});

            – Puddle
            Nov 16 '18 at 3:07











          • Yes, there are also workarounds that involve changing the code.

            – HighCommander4
            Nov 16 '18 at 3:18











          • i also gave GCC 7, 6, 5, 4 a test. but only GCC 5.1.0 worked (with C++11). (the same GCC codeblocks uses)

            – Puddle
            Nov 16 '18 at 3:24













          • You need to make sure Eclipse is picking up the new GCC headers (e.g. F3 on #include <unordered_map> takes you to the right file), and then rebuild index, for a change of compiler to take effect.

            – HighCommander4
            Nov 16 '18 at 3:28













          • i already know that, thanks. (that's obvious usage info you're giving) but you can just build and it gets the new headers. you reindex to correct the syntax. (and that's what i did to obviously check)

            – Puddle
            Nov 16 '18 at 3:34













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330650%2feclipse-cdt-syntax-error-but-still-compiles%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          This is an issue affecting GCC 8 standard library headers, tracked in Eclipse bug 540957. It was fixed for CDT 9.6 (released as part of Eclipse 2018-12).



          UPDATE: The bug was also fixed for CDT 9.5.5, which is planned for an out-of-band release on 2018-11-19. If you're running Eclipse Photon or later, Help -> Check for Updates should pick up this update once it's out.



          A workaround until then is to use GCC 7 or earlier.






          share|improve this answer


























          • thanks for the insight. for now i've found out i can just cast the argument to const dict.insert(std::pair<const int, std::string>{3, "three"});

            – Puddle
            Nov 16 '18 at 3:07











          • Yes, there are also workarounds that involve changing the code.

            – HighCommander4
            Nov 16 '18 at 3:18











          • i also gave GCC 7, 6, 5, 4 a test. but only GCC 5.1.0 worked (with C++11). (the same GCC codeblocks uses)

            – Puddle
            Nov 16 '18 at 3:24













          • You need to make sure Eclipse is picking up the new GCC headers (e.g. F3 on #include <unordered_map> takes you to the right file), and then rebuild index, for a change of compiler to take effect.

            – HighCommander4
            Nov 16 '18 at 3:28













          • i already know that, thanks. (that's obvious usage info you're giving) but you can just build and it gets the new headers. you reindex to correct the syntax. (and that's what i did to obviously check)

            – Puddle
            Nov 16 '18 at 3:34


















          3














          This is an issue affecting GCC 8 standard library headers, tracked in Eclipse bug 540957. It was fixed for CDT 9.6 (released as part of Eclipse 2018-12).



          UPDATE: The bug was also fixed for CDT 9.5.5, which is planned for an out-of-band release on 2018-11-19. If you're running Eclipse Photon or later, Help -> Check for Updates should pick up this update once it's out.



          A workaround until then is to use GCC 7 or earlier.






          share|improve this answer


























          • thanks for the insight. for now i've found out i can just cast the argument to const dict.insert(std::pair<const int, std::string>{3, "three"});

            – Puddle
            Nov 16 '18 at 3:07











          • Yes, there are also workarounds that involve changing the code.

            – HighCommander4
            Nov 16 '18 at 3:18











          • i also gave GCC 7, 6, 5, 4 a test. but only GCC 5.1.0 worked (with C++11). (the same GCC codeblocks uses)

            – Puddle
            Nov 16 '18 at 3:24













          • You need to make sure Eclipse is picking up the new GCC headers (e.g. F3 on #include <unordered_map> takes you to the right file), and then rebuild index, for a change of compiler to take effect.

            – HighCommander4
            Nov 16 '18 at 3:28













          • i already know that, thanks. (that's obvious usage info you're giving) but you can just build and it gets the new headers. you reindex to correct the syntax. (and that's what i did to obviously check)

            – Puddle
            Nov 16 '18 at 3:34
















          3












          3








          3







          This is an issue affecting GCC 8 standard library headers, tracked in Eclipse bug 540957. It was fixed for CDT 9.6 (released as part of Eclipse 2018-12).



          UPDATE: The bug was also fixed for CDT 9.5.5, which is planned for an out-of-band release on 2018-11-19. If you're running Eclipse Photon or later, Help -> Check for Updates should pick up this update once it's out.



          A workaround until then is to use GCC 7 or earlier.






          share|improve this answer















          This is an issue affecting GCC 8 standard library headers, tracked in Eclipse bug 540957. It was fixed for CDT 9.6 (released as part of Eclipse 2018-12).



          UPDATE: The bug was also fixed for CDT 9.5.5, which is planned for an out-of-band release on 2018-11-19. If you're running Eclipse Photon or later, Help -> Check for Updates should pick up this update once it's out.



          A workaround until then is to use GCC 7 or earlier.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 17 '18 at 22:08

























          answered Nov 16 '18 at 3:04









          HighCommander4HighCommander4

          26.8k1797162




          26.8k1797162













          • thanks for the insight. for now i've found out i can just cast the argument to const dict.insert(std::pair<const int, std::string>{3, "three"});

            – Puddle
            Nov 16 '18 at 3:07











          • Yes, there are also workarounds that involve changing the code.

            – HighCommander4
            Nov 16 '18 at 3:18











          • i also gave GCC 7, 6, 5, 4 a test. but only GCC 5.1.0 worked (with C++11). (the same GCC codeblocks uses)

            – Puddle
            Nov 16 '18 at 3:24













          • You need to make sure Eclipse is picking up the new GCC headers (e.g. F3 on #include <unordered_map> takes you to the right file), and then rebuild index, for a change of compiler to take effect.

            – HighCommander4
            Nov 16 '18 at 3:28













          • i already know that, thanks. (that's obvious usage info you're giving) but you can just build and it gets the new headers. you reindex to correct the syntax. (and that's what i did to obviously check)

            – Puddle
            Nov 16 '18 at 3:34





















          • thanks for the insight. for now i've found out i can just cast the argument to const dict.insert(std::pair<const int, std::string>{3, "three"});

            – Puddle
            Nov 16 '18 at 3:07











          • Yes, there are also workarounds that involve changing the code.

            – HighCommander4
            Nov 16 '18 at 3:18











          • i also gave GCC 7, 6, 5, 4 a test. but only GCC 5.1.0 worked (with C++11). (the same GCC codeblocks uses)

            – Puddle
            Nov 16 '18 at 3:24













          • You need to make sure Eclipse is picking up the new GCC headers (e.g. F3 on #include <unordered_map> takes you to the right file), and then rebuild index, for a change of compiler to take effect.

            – HighCommander4
            Nov 16 '18 at 3:28













          • i already know that, thanks. (that's obvious usage info you're giving) but you can just build and it gets the new headers. you reindex to correct the syntax. (and that's what i did to obviously check)

            – Puddle
            Nov 16 '18 at 3:34



















          thanks for the insight. for now i've found out i can just cast the argument to const dict.insert(std::pair<const int, std::string>{3, "three"});

          – Puddle
          Nov 16 '18 at 3:07





          thanks for the insight. for now i've found out i can just cast the argument to const dict.insert(std::pair<const int, std::string>{3, "three"});

          – Puddle
          Nov 16 '18 at 3:07













          Yes, there are also workarounds that involve changing the code.

          – HighCommander4
          Nov 16 '18 at 3:18





          Yes, there are also workarounds that involve changing the code.

          – HighCommander4
          Nov 16 '18 at 3:18













          i also gave GCC 7, 6, 5, 4 a test. but only GCC 5.1.0 worked (with C++11). (the same GCC codeblocks uses)

          – Puddle
          Nov 16 '18 at 3:24







          i also gave GCC 7, 6, 5, 4 a test. but only GCC 5.1.0 worked (with C++11). (the same GCC codeblocks uses)

          – Puddle
          Nov 16 '18 at 3:24















          You need to make sure Eclipse is picking up the new GCC headers (e.g. F3 on #include <unordered_map> takes you to the right file), and then rebuild index, for a change of compiler to take effect.

          – HighCommander4
          Nov 16 '18 at 3:28







          You need to make sure Eclipse is picking up the new GCC headers (e.g. F3 on #include <unordered_map> takes you to the right file), and then rebuild index, for a change of compiler to take effect.

          – HighCommander4
          Nov 16 '18 at 3:28















          i already know that, thanks. (that's obvious usage info you're giving) but you can just build and it gets the new headers. you reindex to correct the syntax. (and that's what i did to obviously check)

          – Puddle
          Nov 16 '18 at 3:34







          i already know that, thanks. (that's obvious usage info you're giving) but you can just build and it gets the new headers. you reindex to correct the syntax. (and that's what i did to obviously check)

          – Puddle
          Nov 16 '18 at 3:34




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53330650%2feclipse-cdt-syntax-error-but-still-compiles%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini