1.下载好qt-win-opensource-4.8.2-vs2010.exe解压安装后,打开VS2010选择Tools->Visual Studio Command Prompt打开Dos窗口
2.进入Qt的安装目录(默认是:C:\Qt\4.8.2)
运行命令 configure -platform win32-msvc2010
选择o回车,Y回车
3.接着是自动配制编译环境,等配置结束后,运行nmake,运行过程中遇到如下bug:
DefaultLocalizationStrategy.cpp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\yvals.h(21) : war
ning C4005: '_HAS_TR1' : macro redefinition
command-line arguments : see previous definition of '_HAS_TR1'
platform\DefaultLocalizationStrategy.cpp(327) : error C2001: newline in constant
platform\DefaultLocalizationStrategy.cpp(327) : fatal error C1057: unexpected en
d of file in macro expansion
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
解决如下: 打开文件: C:\Qt\4.8.2\src\3rdparty\webkit\Source\WebCore\platform\DefaultLocalizationStrategy.cpp 找到327行
删除
如下:
String DefaultLocalizationStrategy::contextMenuItemTagLookUpInDictionary(const String& selectedString)
{
#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
UNUSED_PARAM(selectedString);
return WEB_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item");
#else
#if USE(CF)
RetainPtr selectedCFString(AdoptCF, truncatedStringForLookupMenuItem(selectedString).createCFString());
return formatLocalizedString(WEB_UI_STRING("Look Up “%@”", "Look Up context menu item with selected word"), selectedCFString.get());
#else
return WEB_UI_STRING("Look Up """, "Look Up context menu item with selected word").replace("", truncatedStringForLookupMenuItem(selectedString));
#endif
#endif
}
改为:
String DefaultLocalizationStrategy::contextMenuItemTagLookUpInDictionary(const String& selectedString)
{
#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)
UNUSED_PARAM(selectedString);
return WEB_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item");
#else
#if USE(CF)
RetainPtr selectedCFString(AdoptCF, truncatedStringForLookupMenuItem(selectedString).createCFString());
return formatLocalizedString(WEB_UI_STRING("Look Up “%@”", "Look Up context menu item with selected word"), selectedCFString.get());
#else
return WEB_UI_STRING("Look Up ", "Look Up context menu item with selected word").replace("", truncatedStringForLookupMenuItem(selectedString));
#endif
#endif
}