7 Replies Latest reply on Jan 11, 2016 5:26 PM by CMata_Intel

    Eclipse IDE sees error that is not.

    CABrouwers

      I am working with Eclipse and using the <thread> library.

      The code compiles and runs perfectly .. .but the editor flags symbols from the library as unresolved .. even though the tool chain is fine with them !.

      How can I fix that ?

      - - - - - - - - - - - -  -

      Eclipse Version: Luna SR2 (4.4.2)  Build id: M20150204-1700

      Edison image version: 159.devkit

       


      I have set the project properties :

      C/C++ Buid/Settings/Tool Settings/Cross GCC Compiler/Dialect/Language Standard  ->  ISO C11 (-std = C11)

      C/C++ Buid/Settings/Tool Settings/Cross G++ Compiler/Dialect/Language Standard to  -> ISO C11 (-std = C11)

       

      in my test code, the symbol thread is marked as "Type 'thread' could not be resolved".

       

       

      #include "mraa.hpp"

      #include <iostream>

      #include <thread>

      using namespace std;

       

      void hello(){

              for (;;) {

            cerr << "Hello!" << endl;

            sleep(1);

              }

      }

       

      void goodbye(){

            cerr << "Goodbye!" << endl;

      }

       

      int main() {

       

            thread athread (hello);

       

      for (;;) {

       

       

              goodbye();

              sleep(1);

      }

       

      return 0;

      }

        • 1. Re: Eclipse IDE sees error that is not.
          CMata_Intel

          Hi CABrouwers,

           

          With Eclipse Version: Luna SR2 (4.4.2) (Help > About Eclipse Platform) and the Edison image version: 159.devkit (configure_edison --version)

          I was able to run your code without problems  by doing the following.

          By doing right click on the project > Properties > C/C++ Build > Settings > Cross G++ Linker > Miscellaneous and add -std=c++11 -lpthread on Linker flags. After this, click on Apply and OK

           

          thread.JPG

           

          Let me know if this works.

           

          Regards,

          Charlie

          • 2. Re: Eclipse IDE sees error that is not.
            CABrouwers

            Thanks for your response. Yes the code runs but the symbol "thread" remains flag non-resolved by the editor.

            • 3. Re: Eclipse IDE sees error that is not.
              CMata_Intel

              Hi CABrouwers,

               

              Which Eclipse IDE are you using? And which image version do you have on your board?

              Are you using Eclipse  Luna SR2 (4.4.2) and image 159.devkit?

               

              Try with right click to the project > Properties > C/C++ Build > Settings > Cross G++ Compiler > Dialect > Language Standard : ISO C+ ++11 (-std=c++0x)

              And check the Providers by right clicking to the project > Properties > C/C++ General > Preprocessor Include Paths, Macros etc. > Providers.

               

              prop.JPG

               

              Regards,

              Charlie

              • 4. Re: Eclipse IDE sees error that is not.
                CABrouwers

                Charles,

                 

                Thanks for your response.

                I tried/checked all you indicated .. .the problem remains. The code is produced and runs but the editor flags an error that is not.

                I am working with  a fresh IDE download :

                Version: Luna SR2 (4.4.2)

                Build id: M20150204-1700

                and runing 159.devkit on the Edison.

                 

                 

                sshot.jpg

                • 5. Re: Eclipse IDE sees error that is not.
                  CABrouwers

                  I looked further into the issue and found a few interesting things and perhaps a way for you to reproduce the issue.

                  1. The issue is not only pertaining to the <thread> library but occurs with other C+11 libs such as <mutex>.
                  2. If I create a new project and set the dialect the C+11 BEFORE I first compile. Everything is fine. Otherwise if I compile first and LATER change the dialect to C+11 then the code editor doesn’t recognize the symbols from C+11 libraries (but the compiler and linker process the code without any issue). This is completely reproducible on two computers on which I installed the IDE..
                  3. I compared the .cproject files of two versions of the same project with and without running the code before changing the dialect and I see no material difference.
                  4. The main project I am working on “fixed itself” but I am able to remember what I was doing at the time.
                  • 6. Re: Eclipse IDE sees error that is not.
                    CMata_Intel

                    Hi CABrouwers,

                     

                    After doing the changes in the settings of the project, try by selecting the Project Tab that is next to the Run Tab on the IDE and then click on Build Project, this should take the new changes in the project.

                     

                    Regards,

                    Charlie

                    • 7. Re: Eclipse IDE sees error that is not.
                      CMata_Intel

                      Hi CABrouwers,


                      Do you have updates on this? Have you been able to avoid the error with thread?


                      Regards,

                      Charlie