Results 1 to 7 of 7

Thread: Apparently inconsistent compiler behavior

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: Apparently inconsistent compiler behavior

    Always look at the output of all the tools used to generate files, compile files, link files, ...
    One common problem is that people think that qmake will run all the time. This is not true. If qmake thinks that it doesn't need to alter the makefile, it will not run. In some cases this is wrong.
    Another problem might be that the compiler thinks that some files are not worth preprocessing anymore and it uses the existing object files. Sometimes incorrect.

    How to solve these problems?
    There is only one way to correctly build software and that is from scratch. Always clean the project from object files and generated files and rebuild.

    In the past I made some changes to some KDE code. Before committing the changes I build the code and run the results to see if everything was correct. And everything always was correct before I committed the changes. But then, suddenly, someone complained that the code didn't even compile. How could that be? I checked it.
    So, I double check it, and I compiled the code again (I didn't completely recompile though). Hmmm, strange, it does compile here. So I tell this other guy that he must have made an error somewhere.
    Then another person tells me he can't build the code. I then started looking around what could be the problem. And some of the problems I experienced were that specific files did not get rebuild on my computer, but all these other people were building from scratch and on their computer those specific files did get rebuild resulting in some variables not being available anymore.

    The tools we use are great, but when you build incrementally inside a folder that already contains generated objects and files, strange behavior can and will occur. Always clean the project and rebuild. If you're program is large, split it up in manageable parts.

  2. The following user says thank you to tbscope for this useful post:

    Computer Hater (28th November 2010)

Similar Threads

  1. QT inconsistent performance !!!
    By gontham in forum Qt Programming
    Replies: 7
    Last Post: 12th November 2010, 23:51
  2. Strange compiler behaviour (compiler passes wrong argument)
    By SasaVilic in forum General Programming
    Replies: 2
    Last Post: 2nd November 2010, 11:36
  3. Webpage snapshot program is inconsistent
    By adamkauk in forum Newbie
    Replies: 0
    Last Post: 10th November 2009, 20:04
  4. Replies: 37
    Last Post: 15th July 2009, 22:18
  5. Inconsistent behaviour of QVBoxLayout
    By spraff in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2008, 18:36

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.