我一直在Windows上使用Ludvig Jerabek的GNU getopt端口,并在如下代码行中遇到错误:
if (d->optind != argc && !_tcscmp(argv[d->optind], _T("--")))_tcscmp是一个宏,它在我的系统上解析为strcmp,然后报告strcmp not found。如果我们检查getopt.cpp中的标头:
/* Getopt for Microsoft C
....
Date: 02/03/2011 - Ludvik Jerabek - Initial Release
....
Revisions:
....
08/09/2011
....
#include <stdlib.h>
#include <stdio.h>
#include "getopt.h"我们看到了问题:没有包含<string.h>。我猜在Visual Studio中<string.h>可能是自动包含的?我知道我已经在Visual Studio中成功地构建了getopt.cpp,但是在MinGW上使用带有gcc的手动环境时,它抱怨所有的字符串比较函数都丢失了。对此有何解释?
发布于 2015-04-18 03:21:48
根据字符集宏的不同,真正的tchar.h会导致#include <string.h>或#include <mbstring.h>。
您有一个损坏的tchar.h版本,它不能正确地模拟这些特定于微软的“通用文本例程映射”。
https://stackoverflow.com/questions/29707382
复制相似问题