What am I missing from my environment variables fo

2019-08-27 18:48发布

问题:

I have a Qt project which I have had a debug console displayed whilst I am developing, I am about to ship the product to I removed the qmake console command: CONFIG += console

However when I do that I get the following error:

link /LIBPATH:"c:\Qt\4.5.0\lib" /NOLOGO /INCREMENTAL:NO /LTCG /MANIFEST /MANIFESTFILE:"./_obj/win32\Lynx.intermediate.manifest" /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /VERSION:4.00 /OUT:bin\win32\Lynx.exe @C:\DOCUME~1\hannentp\LOCALS~1\Temp\nm1C9.tmp 
link_.exe /LIBPATH:c:\Qt\4.5.0\lib /NOLOGO /INCREMENTAL:NO /LTCG /MANIFEST /MANIFESTFILE:./_obj/win32\Lynx.intermediate.manifest /SUBSYSTEM:WINDOWS /MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*' /VERSION:4.00 /OUT:bin\win32\Lynx.exe @C:\DOCUME~1\hannentp\LOCALS~1\Temp\nm1C9.tmp~
LINK_ : fatal error LNK1181: cannot open input file 'name='Microsoft.Windows.Common-Controls''
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\link.EXE"' : return code '0x49d'
Stop.

I think that a lib path is missing, however I do have a large number of environment variables setup and working already. Has anybody seen this and know the location of the Microsoft.Windows.Common-Controls?

Also I am running this from buildbot so VS2008's IDE is not really somewhere I want help with.

回答1:

It seems that the command line is just underquoted:

"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"

On the second line, the quotes are gone and the linker treats each word as an object to link. You should probably just add quotes (if it was you who added this argument), ie. begin and end with "\" (3 characters in place of one quote). It seems other sources suggest that too, so try experimenting with that.



回答2:

Not sure, if you made any futher progress on this issue.

I had the very similar error, but with msvc2005 (not IDE). I don't have any instances of link_.exe so I can not verify your fix.

When i enabled console (CONFIG += console), it did not manage to link due to other problem - could not find entry point:

Fatal Error LNK1561: Entry Point Must Be Defined

I randomly found http://support.microsoft.com/kb/140597 which talks about trailing backslash characters, thought it is stated that is for msvc 4 and was fixed later. I checked my code, and I have trailing forwardslashes when specified the LIBPATH in .pro file. I fixed those, and got the thing to compile with (CONFIG += console). Now I removed the option, and having different but somewhat logical problem:

MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
app.exe : fatal error LNK1120: 1 unresolved externals

Looking at your nmake output, I am wondering if mixing forward and backslash characters in

/MANIFESTFILE:"./_obj/win32\Lynx.intermediate.manifest"

causing this problem. Though it might something different.

Note, I also have CONFIG -= embed_manifest_exe in my .pro file. My nmake out looks like this:

link /LIBPATH:"c:\Apps\boost\boost_1_38\lib" /NOLOGO /INCREMENTAL:NO /LTCG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /OUT:valueForSba.exe @C:\DOCUME~1\LOCALS~1\Temp\nm398.tmp
Creating library app.lib and object app.exp
MSVCRT.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16
app.exe : fatal error LNK1120: 1 unresolved externals

I also not using any qt classes in this project, and only use qmake to get the Makefile. (qmake from 4.5.1 commercial edition)



回答3:

I was under the impression that Qt's free version only builds with Mingw, NOT Visual Studio. If you're using the free version of Qt that might be the problem. If you're not familiar with Mingw, its the GCC compiler toolchain tweaked for use under windows with their .lib files for various Windows specific libraries.



回答4:

From what I have found on Microsoft's site, Comctl32.dll is the library you need to locate and add its path to your build environment. See if that works.



回答5:

I have been suffering from the same problem. It turned out that this pc has two different MSVC versions( 7.1 and 8.0). Although the SDK is built for 8.0 one, it was selected for 7.1 in QtCreator Tools->Options->Qt4->Qt4 Versions. So I switched it to Version 8.0 and It works fine now.