Qt doesn't care about the changed code
-
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! -
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!@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. -
Hi,
- 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,
-
@jsulm Yes, I'm using Qt Creator (Community). I created the header file doing the following:
- Create the header file clicking on Sources --> Right Click --> Create Header File...
- I include the "header.h" in my main.c file.
- I put some functions in the header.h e call it from the maic.c
- 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!
-
@jsulm Yes, I'm using Qt Creator (Community). I created the header file doing the following:
- Create the header file clicking on Sources --> Right Click --> Create Header File...
- I include the "header.h" in my main.c file.
- I put some functions in the header.h e call it from the maic.c
- 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!
@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. -
@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.
-
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.