我尝试使用TDM-GCC 4.7.1 32位在Windows 10上编译wxWidgets 3.0.2项目,我收到以下错误:
汇编
mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -std=c++11 -g -Wall -std=c++11 -g -Ilibrary\xerces-c-3.1.1\src -Ilibrary\mupdf-1.6\include -Ilibrary\wxWidgets-3.0.2\include -Ilibrary\wxWidgets-3.0.2\lib\wx\include\msw-unicode-3.0\ -Iinclude -IC:\TDM471-32\include -IC:\TDM471-32\include -c F:\Proj\Document.cpp -o obj\Debug\Document.o
错误
In file included from library\wxWidgets-3.0.2\include/wx/string.h:45:0,
from library\wxWidgets-3.0.2\include/wx/memory.h:15,
from library\wxWidgets-3.0.2\include/wx/object.h:19,
from library\wxWidgets-3.0.2\include/wx/wx.h:15,
from F:\Proj\Document.h:4,
from F:\Proj\Document.cpp:1:
library\wxWidgets-3.0.2\include/wx/wxcrtbase.h: In function 'wchar_t* wxStrdup(const wchar_t*)':
library\wxWidgets-3.0.2\include/wx/wxcrtbase.h:680:68: error: 'wcsdup' was not declared in this scope
In file included from library\wxWidgets-3.0.2\include/wx/string.h:45:0,
from library\wxWidgets-3.0.2\include/wx/memory.h:15,
from library\wxWidgets-3.0.2\include/wx/object.h:19,
from library\wxWidgets-3.0.2\include/wx/wx.h:15,
from F:\Proj\Main.cpp:1:
library\wxWidgets-3.0.2\include/wx/wxcrtbase.h: In function 'wchar_t* wxStrdup(const wchar_t*)':
library\wxWidgets-3.0.2\include/wx/wxcrtbase.h:680:68: error: 'wcsdup' was not declared in this scope
In file included from library\wxWidgets-3.0.2\include/wx/crt.h:19:0,
In file included from library\wxWidgets-3.0.2\include/wx/crt.h:19:0,
from library\wxWidgets-3.0.2\include/wx/string.h:4305,
from library\wxWidgets-3.0.2\include/wx/memory.h:15,
from library\wxWidgets-3.0.2\include/wx/object.h:19,
from library\wxWidgets-3.0.2\include/wx/wx.h:15,
from F:\Proj\Document.h:4,
from F:\Proj\Document.cpp:1:
library\wxWidgets-3.0.2\include/wx/wxcrt.h: In function 'size_t wxStrnlen(const char*, size_t)':
library\wxWidgets-3.0.2\include/wx/wxcrt.h:173:92: error: 'strnlen' was not declared in this scope
library\wxWidgets-3.0.2\include/wx/wxcrt.h: In function 'size_t wxStrnlen(const wchar_t*, size_t)':
library\wxWidgets-3.0.2\include/wx/wxcrt.h:187:95: error: 'wcsnlen' was not declared in this scope
from library\wxWidgets-3.0.2\include/wx/string.h:4305,
from library\wxWidgets-3.0.2\include/wx/memory.h:15,
from library\wxWidgets-3.0.2\include/wx/object.h:19,
from library\wxWidgets-3.0.2\include/wx/wx.h:15,
from F:\Proj\Main.cpp:1:
library\wxWidgets-3.0.2\include/wx/wxcrt.h: In function 'size_t wxStrnlen(const char*, size_t)':
library\wxWidgets-3.0.2\include/wx/wxcrt.h:173:92: error: 'strnlen' was not declared in this scope
library\wxWidgets-3.0.2\include/wx/wxcrt.h: In function 'size_t wxStrnlen(const wchar_t*, size_t)':
library\wxWidgets-3.0.2\include/wx/wxcrt.h:187:95: error: 'wcsnlen' was not declared in this scope
答案 0 :(得分:0)
我不确定这是否能解释您的问题,但是,无论如何,在命令行上使用-DwxUSE_UNICODE
是错误的,所有wxUSE_XXX
符号都应该被定义为0或者1,不是没有。但即使-DwxUSE_UNICODE=1
也是错误的,因为这可能导致CRT / SDK和wxWidgets标头之间不匹配。相反,您应该预定义_UNICODE
和/或UNICODE
(前者由CRT使用,后者由SDK使用,但SDK也将使用下划线获取版本)并且wxWidgets将尊重它同样。