Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Error unknown typ name 'DS18B20'
Forum Updated to NodeBB v4.3 + New Features

Error unknown typ name 'DS18B20'

Scheduled Pinned Locked Moved Solved Mobile and Embedded
93 Posts 4 Posters 33.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A AlexKrammer

    @mrjj
    yes i did it?
    i created a object of Test in MainWindow
    then i put c.NUM = 100;

    after that i created a object of Test in CheckTemperature too
    but c.NUM dont have 100. Its still have 0.

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #84

    @AlexKrammer So, you create two instances of Test, change one of them and expect the other one to have the same change? How? By magic? Maybe I don't get something as the thread is already quite long...

    Test a;
    Test b;
    a.NUM = 100;
    // Why should b.NUM be 100 now?!
    

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    A 1 Reply Last reply
    1
    • jsulmJ jsulm

      @AlexKrammer So, you create two instances of Test, change one of them and expect the other one to have the same change? How? By magic? Maybe I don't get something as the thread is already quite long...

      Test a;
      Test b;
      a.NUM = 100;
      // Why should b.NUM be 100 now?!
      
      A Offline
      A Offline
      AlexKrammer
      wrote on last edited by AlexKrammer
      #85

      @jsulm
      where do i create two instaces of Test? I only create a Object of TEST with c. change the Variable NUM and try to get c.NUM in a other Class

      class TEST{
      int NUM = 0;
      }

      MainWindow{
      TEST c;
      c.NUM = 100;
      }

      CheckTemperature
      {
      float example;
      TEST c;
      example = c.NUM;
      //example still 0
      }

      Or do i change the value of the variable in the object TEST c (c.NUM) i created? Not the Variable in the class TEST

      jsulmJ 1 Reply Last reply
      0
      • A AlexKrammer

        @jsulm
        where do i create two instaces of Test? I only create a Object of TEST with c. change the Variable NUM and try to get c.NUM in a other Class

        class TEST{
        int NUM = 0;
        }

        MainWindow{
        TEST c;
        c.NUM = 100;
        }

        CheckTemperature
        {
        float example;
        TEST c;
        example = c.NUM;
        //example still 0
        }

        Or do i change the value of the variable in the object TEST c (c.NUM) i created? Not the Variable in the class TEST

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by jsulm
        #86

        @AlexKrammer said in Error unknown typ name 'DS18B20':

        where do i create two instaces of Test?

        In the code you just posted (hint: instance is the same thing as object):

        MainWindow{
        TEST c; // First instance
        c.NUM = 100;
        }
        
        CheckTemperature
        {
        float example;
        TEST c; // Second instance, c here is NOT the same as in MainWindow!
        example = c.NUM;
        //example still 0
        }
        

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        mrjjM 1 Reply Last reply
        2
        • jsulmJ jsulm

          @AlexKrammer said in Error unknown typ name 'DS18B20':

          where do i create two instaces of Test?

          In the code you just posted (hint: instance is the same thing as object):

          MainWindow{
          TEST c; // First instance
          c.NUM = 100;
          }
          
          CheckTemperature
          {
          float example;
          TEST c; // Second instance, c here is NOT the same as in MainWindow!
          example = c.NUM;
          //example still 0
          }
          
          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #87

          @jsulm said in Error unknown typ name 'DS18B20':

          TEST c; // First instance

          This has to go in .h , in the MainWindow class and then

          TEST c; // Second instance, has to be removed then
          its the same and it should work.

          A 1 Reply Last reply
          1
          • mrjjM mrjj

            @jsulm said in Error unknown typ name 'DS18B20':

            TEST c; // First instance

            This has to go in .h , in the MainWindow class and then

            TEST c; // Second instance, has to be removed then
            its the same and it should work.

            A Offline
            A Offline
            AlexKrammer
            wrote on last edited by
            #88

            @mrjj
            If i create in MainWindow.h a instance called TEST c;

            That instance won't work in class CheckTemperature. Will it?

            mrjjM 1 Reply Last reply
            0
            • A AlexKrammer

              @mrjj
              If i create in MainWindow.h a instance called TEST c;

              That instance won't work in class CheckTemperature. Will it?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #89

              @AlexKrammer
              No as its 2 different instances. one in MainWin and one in CheckTemperature.
              They are not the same.

              A 1 Reply Last reply
              0
              • mrjjM mrjj

                @AlexKrammer
                No as its 2 different instances. one in MainWin and one in CheckTemperature.
                They are not the same.

                A Offline
                A Offline
                AlexKrammer
                wrote on last edited by
                #90

                @mrjj
                And is there a posibility to use a variable of a class in 2 other classes

                mrjjM 1 Reply Last reply
                0
                • A AlexKrammer

                  @mrjj
                  And is there a posibility to use a variable of a class in 2 other classes

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #91

                  @AlexKrammer
                  Yes if you use a pointer or reference then it will point back to the original variable.

                  like

                  int Num=0; the actual one

                  class Test() {
                  int &NumRef;
                  void Test( int MyNum ) : NumRef(MyNum) {}
                  }

                  then when you create the instance

                  Test MyTest(Num);

                  Then it points to the actual one and will always have the same value.

                  But often its not the best idea and can be solved other way like give it directly when you want to
                  other classes to use the data.

                  class Test() {
                  int DoSomething(int NumTouse);
                  }

                  Test c;
                  int result = c.DoSomething(Num);

                  A 1 Reply Last reply
                  2
                  • mrjjM mrjj

                    @AlexKrammer
                    Yes if you use a pointer or reference then it will point back to the original variable.

                    like

                    int Num=0; the actual one

                    class Test() {
                    int &NumRef;
                    void Test( int MyNum ) : NumRef(MyNum) {}
                    }

                    then when you create the instance

                    Test MyTest(Num);

                    Then it points to the actual one and will always have the same value.

                    But often its not the best idea and can be solved other way like give it directly when you want to
                    other classes to use the data.

                    class Test() {
                    int DoSomething(int NumTouse);
                    }

                    Test c;
                    int result = c.DoSomething(Num);

                    A Offline
                    A Offline
                    AlexKrammer
                    wrote on last edited by
                    #92

                    @mrjj well thank you very much. My problem has been fixed and about this problem i'm going to read something on a c++ article.
                    Thanks for your time.

                    mrjjM 1 Reply Last reply
                    1
                    • A AlexKrammer

                      @mrjj well thank you very much. My problem has been fixed and about this problem i'm going to read something on a c++ article.
                      Thanks for your time.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #93

                      @AlexKrammer
                      Good to hear and you are welcome.
                      Its a good idea to read up on c++ as Qt uses it a lot and
                      its best to have good understanding on some of the concepts as not to feel really uphill:)

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved