Reputation: 9156
I just started using Qt Creator 3.5.0, Qt 5.4.2 with GCC on Kubuntu 15.10. I created a new project, added a window and currently I am trying to develop a new module.
However strange things happen.
I wrote a debug output line in my template class X. The line is located in a function of class X in the header of its module, e.g.:
qDebug() << "Hello1" << endl;
After building and running the application this line is executed and "Hello1" is printed in the debug console as desired. Also I can use the debugger and step through the line. When building the application the compiler does essentially nothing since no code file was changed (as expected).
When editing the above line things go weired:
More facts:
I have no idea how this is possible. Maybe I missed something obvious. Any ideas?
UPDATE: Using system monitor I could confirm that the running process uses the expected executeable.
Upvotes: 3
Views: 10983
Reputation: 2648
Problem still exists under Qt 5.8:
This problem continues to arise with Qt 5.8 using clang, building 64-bit for OSX, under OSX, from within Qt Creator. So it's not a GCC issue.
Solution:
I was able to get dependent compiles to respond correctly to changes to a newly added header file by:
Checks:
Before doing the above, I checked the project file and made sure that the new file was listed in the HEADERS
section (it was.) Despite this, Qt would not rebuild the file that included the .h
file.
Upvotes: 1
Reputation: 11
Modify your main.cpp and recompile this should update your code. Not sure why this is happening but I add a cout << "Ver: 1 \n"; and update the number every time I change the header file. This seems to be a workaround.
Upvotes: 1
Reputation: 57
I've experienced this issue as well. I was able to resolve it by cleaning (in my case running catkin clean
) and then re-building it (catkin_make
).
Unfortunately I haven't been able to figure out the exact cause of the problem, but hopefully someone more knowledgeable has an idea.
In addition, my development environment is different (Ubuntu 14.04, Qmake 3.1, Qt 5.9.1, gcc 4.8.4, catkin tools 0.4.4, Qt Creator etc) so obviously my fix may not work for everyone.
Upvotes: 0
Reputation: 764
You can try some things:
It seems to be compiling the last 'version' of your code and not applying the changes for some of that reasons and others (If I think in other things I'll edit the post later).
Hope it helps
Upvotes: 2
Reputation: 5642
Check which exe the debugger is actually running. It may be another copy! Look at a process listing to know for sure what EXE is under the debugger.
This general issue has happened for various reasons in my personal experience. Files get copied to an install/staging area; the environment shadows things; the wrong project is set to "start up"; the way the component is run when starting the debug session ends up resolving to the wrong file; the wrong configuration or flavor is being changed; etc.
Rule 1: verify your assumptions. You checked file dates etc. but add to that checking what file (full path) is actually under the debugger.
Upvotes: 1