windows 全新安装 Qt SDK 和 Visual C++ 2008 的 LNK4099 链接器警告
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8359550/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
LNK4099 linker warning with clean install of Qt SDK and Visual C++ 2008
提问by James Johnston
Did a clean install on a new Windows 7 computer with:
在新的 Windows 7 计算机上进行了全新安装:
- Visual Studio 2008 SP1
- Qt SDK 1.1.4
- 视觉工作室 2008 SP1
- Qt SDK 1.1.4
Then I created a new project in Qt Creator. I picked "Qt Gui Application" under "Qt Widget Project" and had it target desktops with Visual C++ 2008, both debug & release (basically default settings).
然后我在 Qt Creator 中创建了一个新项目。我在“Qt Widget Project”下选择了“Qt Gui Application”,并将其定位到带有 Visual C++ 2008 的桌面,包括调试和发布(基本上是默认设置)。
Then I pressed Build, and got....
然后我按了 Build,然后得到了......
qtmaind.lib(qtmain_win.obj):-1: warning: LNK4099: PDB 'vc90.pdb' was not
found with 'c:\QtSDK\Desktop\Qt.7.4\msvc2008\lib\qtmaind.lib' or at
'C:\Users\JamesJ\Desktop\QtTest-build-desktop-Qt_4_7_4_for_Desktop_-
_MSVC2008__Qt_SDK__Debug\debug\vc90.pdb'; linking object as if no debug info
I must be missing something obvious - surely the out-of-box experience with Qt isn't supposed to involve compiler/linker warnings?!?!
我一定遗漏了一些明显的东西 - Qt 的开箱即用体验肯定不应该涉及编译器/链接器警告?!?!
How do I resolve this linker warning? I prefer to treat warnings as errors, so... I'd like to get this fixed.
如何解决此链接器警告?我更喜欢将警告视为错误,所以......我想解决这个问题。
采纳答案by James Johnston
Was unable to find a solution to this. I'm sure recompiling Qt would resolve the issue, but for simplicity I want to stick with what is installed with the SDK for now.
无法找到解决方案。我确信重新编译 Qt 会解决这个问题,但为了简单起见,我现在想坚持使用 SDK 安装的内容。
回答by Gnawme
The path to vc90.pdb
embedded in qtmain_win.obj
is not the same path that is set in your linker settings.
vc90.pdb
嵌入的路径与qtmain_win.obj
链接器设置中设置的路径不同。
Per the instructions in this article:
根据本文中的说明:
In the linker settings, Properties->Linker->Debugging->Generate Program Database File
has the value $(TargetDir)$(TargetName).pdb
.
在链接器设置中,Properties->Linker->Debugging->Generate Program Database File
值为$(TargetDir)$(TargetName).pdb
。
In the C/C++ settings, Properties->C/C++->Output Files->Program Database File
should alsobe set to $(TargetDir)$(TargetName).pdb
(its default value is $(IntDir)\vc90.pdb
).
在C / C ++设置,Properties->C/C++->Output Files->Program Database File
应该也被设置为$(TargetDir)$(TargetName).pdb
(其缺省值为$(IntDir)\vc90.pdb
)。
Failing that, you can try cleaning and rebuilding the Debug build.
如果失败,您可以尝试清理和重建调试版本。
回答by patraulea
Separately installing Qt Library (4.8.2) and Qt Creator (2.5.2) worked here. I no longer get the LNK4099 warning.
单独安装 Qt Library (4.8.2) 和 Qt Creator (2.5.2) 在这里工作。我不再收到 LNK4099 警告。
Make sure to remove the settings QtSDK leaves behind: the keys in KHCU\Software\Nokia
and the %APPDATA%\Nokia
folder.
确保删除 QtSDK 留下的设置:密钥KHCU\Software\Nokia
和%APPDATA%\Nokia
文件夹。
Upgrading QT Library manually within QtSDK package manager might also work.
在 QtSDK 包管理器中手动升级 QT 库也可能有效。
回答by BartoszKP
This happens when you move Qt directories (i.e. the ones containing libs/pdbs) to a different directory after compilation. The path to the PDB file is embedded in the libraries, so when you move them the linker cannot find it.
当您在编译后将 Qt 目录(即包含 libs/pdbs 的目录)移动到不同的目录时,就会发生这种情况。PDB 文件的路径嵌入在库中,因此当您移动它们时,链接器找不到它。
Seems for me that the safest/cleanest issue is to rebuild Qt in the new location.
在我看来,最安全/最干净的问题是在新位置重建 Qt。
回答by Jeka
Add
添加
QMAKE_LFLAGS += /ignore:4099
QMAKE_LFLAGS += /ignore:4099
to your .pro file.
到您的 .pro 文件。
if you want to not create .pdb files for your executables or library add
如果您不想为可执行文件或库创建 .pdb 文件,请添加
QMAKE_CXXFLAGS += /Z7
QMAKE_CXXFLAGS += /Z7
so debug information will put in .obj files.
所以调试信息将放在 .obj 文件中。
You maybe need to delete all Makefiles* to update the building rules. Tested in Qt Creator 2.4.1 with MSVC 2008 SP1
您可能需要删除所有 Makefile* 以更新构建规则。在 Qt Creator 2.4.1 和 MSVC 2008 SP1 中测试