我正在尝试编译 pgpfone,我从 VS6 迁移到 VS2008 再到 VS2015 的构建系统有问题。
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /I.\ /I..\common /I..\bignum /I..\..\..\libs\pfl\win32 /I..\..\..\libs\pfl\common /I..\..\..\libs\pfl\common\util /ZI /nologo /W2 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _WINDOWS /D PGP_WIN32=1 /D PGPXFER=1 /D PGP_INTEL=1 /D BNINCLUDE=bni80386c.h /D _VC80_UPGRADE=0x0600 /Gm /EHsc /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo".\Debug/" /Fd".\Debug/vc140.pdb" /Gd /TP /analyze- /errorReport:queue ..\common\ADPCM.cpp ..\common\blowfish.cpp ..\common\bytefifo.cpp ..\common\cast5.cpp ..\common\CControlThread.cpp ..\common\CCounterEncryptor.cpp ..\common\CEncryptionStream.cpp ..\common\CMessageQueue.cpp ..\common\CPFPackets.cpp ..\common\CPFTransport.cpp ..\common\CPipe.cpp ..\common\CPriorityQueue.cpp ..\common\crc.cpp ..\common\CSoundInput.cpp ..\common\CSoundOutput.cpp ..\common\CXferThread.cpp ..\common\des3.cpp ..\common\dh.cpp ..\common\DHPrimes.cpp ..\common\fastpool.cpp ..\common\HashWordList.cpp ..\common\PGPFoneUtils.cpp ..\common\samplerate.cpp ..\common\SHA.cpp CAuthWindow.cpp CEncryptionDialog.cpp CFileTransferDialog.cpp CLevelMeter.cpp CModemDialog.cpp CPFTInternet.cpp CPFTSerial.cpp CPFWindow.cpp CPGPFone.cpp CPGPFoneFrame.cpp CPGPFStatusBar.cpp CPhoneDialog.cpp CSoundLight.cpp CStatusPane.cpp CTriThreshold.cpp CWinFilePipe.cpp CXferWindow.cpp LMutexSemaphore.cpp LSemaphore.cpp LThread.cpp PGPFWinUtils.cpp
PGPFWinUtils.cpp
_WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
atlmfc\include\afxrendertarget.h(142): warning C4003: not enough actual parameters for macro 'IsNull' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
atlmfc\include\afxrendertarget.h(142): error C2059: syntax error: '(' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
atlmfc\include\afxrendertarget.h(142): error C2143: syntax error: missing ')' before '==' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
atlmfc\include\afxrendertarget.h(142): error C2143: syntax error: missing ',' before '==' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
atlmfc\include\afxrendertarget.h(142): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
atlmfc\include\afxrendertarget.h(142): error C2059: syntax error: '==' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
atlmfc\include\afxrendertarget.h(142): error C2059: syntax error: ')' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
atlmfc\include\afxrendertarget.h(142): error C2059: syntax error: '{' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
atlmfc\include\afxrendertarget.h(142): error C2334: unexpected token(s) preceding '{'; skipping apparent function body [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
这是完整的日志: https://ci.appveyor.com/project/ysangkok/pgpfone
如何找出导致错误的原因?我假设 PGPFWinUtils.cpp 的代码包含一个错误调用宏的 header ,从而导致错误,但我不知道它会在哪里。
是否可以使用 Visual C++ 获得宏回溯?我记得 Clang 或 GCC 有这个功能。
这是完整的来源:https://github.com/ysangkok/pgpfone/blob/master/src/win32/PGPFWinUtils.cpp
我在 AppVeyor 上编译,我在本地没有 afxrendertarget.h 的源代码。如何在 Ubuntu 上下载用于 header 检查的 Windows SDK?
最佳答案
atlmfc\include\afxrendertarget.h(142): warning C4003: not enough actual parameters for macro 'IsNull' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]
第一个错误提供了一些线索:
line #
142
inafxrendertarget.h
是的成员函数
;BOOL IsNull() const
的内联定义CD2DSizeFC4003
指的是宏IsNull
的非法扩展。
这表明一些其他非 MFC 头文件 #define
的宏 IsNull
,并且当该头文件包含在前面时(包含的 MFC 头文件) afxrendertarget.h
IsNull
宏破坏了 IsNull
成员函数声明。
关于c++ - MFC header 中的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38752256/