Sunday, December 11, 2016

Qt error LNK1181: cannot open input file 'debug\main.obj'

Qt is great, but if you're just getting started playing around with the framework in Windows, you may have come across this ridiculous problem:

1) You make a 'Hello World' which works
2) You copy the project, or rename/move it
3) 'Hello World' no longer works with LNK1181 error

This seems like one of the dumbest things ever, and it is related to an option in the project's Build Settings (click on the Projects tool button with the green wrench) called Shadow build:



This seems like quite a useful option for advanced users, but having it set as the default is crazy... I've wasted a couple hours with it and still can't figure out what I'm supposed to do to make it work when I've made a copy of the original project (probably when the project is first created, some entry is made somewhere to add the new 'shadow' location to the environment when the compiler is called... but I don't give a %&@$, I am just trying to make a basic little forms app).  So just disable it, and the build directory will be the same as the project directory, and it should compile fine.

Hope this helps someone out there, and maybe Qt will rethink having this as the default setting.

Z