前言
windows xp正在慢慢退出历史舞台,但是目前还没退出。还有大量的xp系统存活着。为了兼容它们,费了不少功夫,值得一说。
正文
Qt
Qt的xp支持分两个部分,根据不同的编译器,来进行不同的处理
vs编译器
需要在pro文件中加上
#QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
#QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.01
#DEFINES += _ATL_XP_TARGETING
不加的话,会报”不是windows程序”的错误。
参考0
mingw编译器
默认已经支持xp了。
但是你不能使用一些函数例如:strcat_s。strcat是可以的。我猜测凡是带”_s”都不可以。
ffmpeg
跑在xp系统上,会报”getnumanodeprocessormaskex”在kernel.dll中找不到错误。
参考1
参考2
需要下载一个软件,把dll里面的链接修改了一下。
我看到这里
FT ft[]={
{"_wfopen_s", "_wfopen"},
{"strncpy_s", "strncpy"},
{"swscanf_s", "swscanf"},
{"strtok_s", "strtok"},
{"GetNumaNodeProcessorMaskEx", "GetNumaNodeProcessorMask"},
{"InitializeConditionVariable", "InitializeCriticalSection"},
{"SetThreadGroupAffinity", "SetThreadAffinityMask"},
{"SleepConditionVariableCS", "LeaveCriticalSection"},
{"WakeAllConditionVariable", "EnterCriticalSection"},
};
它的作用貌似是把调用的库改了一下。以此类推,当其他的库应该也可以这么处理一下,就兼容xp了。
不过我感觉而这种方式有点危险。
补充
mysys2已经放弃支持xp了,竟然装不上。
chrome浏览器也放弃支持了。
总结
如果有可能,劝说客户放弃xp系统。