VS2010上不区分大小写的字符串比较-为每个版本的VS播放#if定义的语句
Case-insensitive string comparison on VS2010 - playing with #if defined statements for each version of VS
我正在将一些旧代码转换为Visual Studio 2010项目,下面的代码给了我错误。。。
#if _MSC_VER >= 1200 || defined __BORLANDC__
#define cv_stricmp stricmp
#define cv_strnicmp strnicmp
#if defined WINCE
#define strdup _strdup
#define stricmp _stricmp
#endif
#elif defined __GNUC__ || defined __sun
#define cv_stricmp strcasecmp
#define cv_strnicmp strncasecmp
#else
#error Do not know how to make case-insensitive string comparison on this platform
#endif
我不知道如何在VisualStudio2010中采用这些语句。我怎么能这么做?
我想你不是说#error
被击中,因为VC 2010不会发生这种情况。
如果您指的是弃用警告,请尝试使用_stricmp
和_strnicmp
:
#if _MSC_VER >= 1200 || defined __BORLANDC__
#if _MSC_VER >= 1400
#define cv_stricmp _stricmp
#define cv_strnicmp _strnicmp
#else
#define cv_stricmp stricmp
#define cv_strnicmp strnicmp
` #endif
#if defined WINCE
#define strdup _strdup
#define stricmp _stricmp
#endif
#elif defined __GNUC__ || defined __sun
#define cv_stricmp strcasecmp
#define cv_strnicmp strncasecmp
#else
#error Do not know how to make case-insensitive string comparison on this platform
#endif
相关文章:
- 在VS代码中交叉编译Windows与Linux上的MinGW的SDL程序
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 导入库可以跨dll版本工作吗
- 如何为模板化对象创建模板向量?VS正在投掷C3203
- 数据成员SFINAE的C++17测试:gcc vs clang
- 为什么在Windows上的VS 2019和Clang 9中"size_t"在没有标题的情况下工作
- 在调用FreeLibrary后,释放动态链接到具有相同版本的CRT堆的DLL的内存
- 在for循环中使用auto vs decltype(vec.size())来处理字符串的向量
- 正在VS调试器中监视映射条目
- Confusion: decltype vs std::function
- 我如何在VS 2017中的Windows安装程序安装Windows安装程序应配置What what版本
- 集成在不同VS版本中开发的应用程序
- 如何在vs android版本中启用c++0x
- 在 VS 和 Linux 版本中包含相同的 #define
- VS2010上不区分大小写的字符串比较-为每个版本的VS播放#if定义的语句
- 是否有可能在调试版本中编译VS项目,包括通过不同的项目进行调试的断点
- 为什么即使在调试版本中,VS 和 Windbg 也会"this"指针打印为"0xcccccccc"?
- 代码在VS 2008中运行良好,但在更高版本的VS中则不行
- Visual Studio 2008 - 获取 VS C++ 项目的版本号
- 如何在 VS 版本之间创建一致的 dll 二进制文件