Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt doesn't care about the changed code
QtWS25 Last Chance

Qt doesn't care about the changed code

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.4k Views
  • 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.
  • N Offline
    N Offline
    NeoFahrenheit
    wrote on last edited by NeoFahrenheit
    #1

    I'm building a 2048 game copy with ncurses. It runs smooth the first time. I create a header file, put some code there, link it. Run it again. Nice. But when I try to chance my code, sumply by changing a "Hello World" string, the code "doens't update" at all (does not show the updated string on terminal).

    I can destroy my code, removing everything important and the Qt still runs that first piece of code and doens't matter what I make with the code later. I tried to remove that header file and put everything back on main.c again and still nothing.

    I don't know what happened. Everything was running fine, when suddently...
    I put this exact same code on another IDE and it was fine.

    Can you guys help?
    Thanks so much!

    jsulmJ 1 Reply Last reply
    0
    • N NeoFahrenheit

      I'm building a 2048 game copy with ncurses. It runs smooth the first time. I create a header file, put some code there, link it. Run it again. Nice. But when I try to chance my code, sumply by changing a "Hello World" string, the code "doens't update" at all (does not show the updated string on terminal).

      I can destroy my code, removing everything important and the Qt still runs that first piece of code and doens't matter what I make with the code later. I tried to remove that header file and put everything back on main.c again and still nothing.

      I don't know what happened. Everything was running fine, when suddently...
      I put this exact same code on another IDE and it was fine.

      Can you guys help?
      Thanks so much!

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

      @NeoFahrenheit First of all: Qt is innocent here. The problem you have is with QtCreator (I guess you're using it?) and qmake.
      "I create a header file, put some code there, link it" - how? Can you explain more? Is this new file in your .pro file?
      Also after adding new files you should rerun qmake and do a rebuild.

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

      1 Reply Last reply
      3
      • Pradeep KumarP Offline
        Pradeep KumarP Offline
        Pradeep Kumar
        wrote on last edited by
        #3

        Hi,

        @NeoFahrenheit

        1. Once do clean->run qmake->then build->then run.

        running qmake is necessary when u add new files or modify the .pro file of the respective project.

        adding to @jsulm , did u add new file and , check in the .pro file of ur project, whether the file is been added and then do as mentioned in point (1).

        Thanks,

        Pradeep Kumar
        Qt,QML Developer

        1 Reply Last reply
        3
        • N Offline
          N Offline
          NeoFahrenheit
          wrote on last edited by NeoFahrenheit
          #4

          @jsulm Yes, I'm using Qt Creator (Community). I created the header file doing the following:

          1. Create the header file clicking on Sources --> Right Click --> Create Header File...
          2. I include the "header.h" in my main.c file.
          3. I put some functions in the header.h e call it from the maic.c
          4. PS: I also add "main.c" to my header files to enable auto-complete.

          That's basically it. The headers are in the .pro file.

          @Pradeep-Kumar I was doing a similar process, but I wasn't running qmake, I think. Only cleaning, rebuilding and running it again.

          Now the Qt is working fine.
          I found it weird because I have played with some headers files before and never had this problem.

          Thanks so much for your help!

          jsulmJ 1 Reply Last reply
          0
          • N NeoFahrenheit

            @jsulm Yes, I'm using Qt Creator (Community). I created the header file doing the following:

            1. Create the header file clicking on Sources --> Right Click --> Create Header File...
            2. I include the "header.h" in my main.c file.
            3. I put some functions in the header.h e call it from the maic.c
            4. PS: I also add "main.c" to my header files to enable auto-complete.

            That's basically it. The headers are in the .pro file.

            @Pradeep-Kumar I was doing a similar process, but I wasn't running qmake, I think. Only cleaning, rebuilding and running it again.

            Now the Qt is working fine.
            I found it weird because I have played with some headers files before and never had this problem.

            Thanks so much for your help!

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

            @NeoFahrenheit said in Qt doesn't care about the changed code:

            I also add "main.c" to my header files to enable auto-complete

            main.c is not a header file and should not be added to headers!
            Add it to SOURCES instead of HEADERS.

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

            1 Reply Last reply
            3
            • N Offline
              N Offline
              NeoFahrenheit
              wrote on last edited by
              #6

              @jsulm I think it's already in SOURCES, although I dont get auto-complete on header files that way. :(

              PS: I do get auto-complete, but not with functions of libraries, like stdio.h or ncurses.h. For example, if I type print, I don't get the printf or printw sugestions, only 'private' when I start typing the word.

              alt text

              1 Reply Last reply
              0
              • N Offline
                N Offline
                NeoFahrenheit
                wrote on last edited by
                #7

                Up!
                I really need this auto-complete.

                For now, I'm using #include "main.c" on headers to code and deleting it before running it.

                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