简体   繁体   English

MFC标头中的语法错误

[英]Syntax error in MFC header

I am trying to compile pgpfone, and I have a problem with the build system which I migrated from VS6 to VS2008 and then to VS2015. 我正在尝试编译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]

Here is the full log: https://ci.appveyor.com/project/ysangkok/pgpfone 这是完整的日志: https : //ci.appveyor.com/project/ysangkok/pgpfone

How can I find out what is causing the error? 我如何找出导致错误的原因? I assume that the code of PGPFWinUtils.cpp is including a header that call a macro incorrectly, causing the error, but I can't figure out where that would be. 我假设PGPFWinUtils.cpp的代码包含错误地调用宏的标头,从而导致错误,但我不知道该在哪里。

Is it possible with Visual C++ to get a macro-backtrace? 使用Visual C ++是否可以获取宏回溯? I remember Clang or GCC has this feature. 我记得Clang或GCC具有此功能。

Here is the full source: https://github.com/ysangkok/pgpfone/blob/master/src/win32/PGPFWinUtils.cpp 这是完整的源代码: https : //github.com/ysangkok/pgpfone/blob/master/src/win32/PGPFWinUtils.cpp

I am compiling on AppVeyor, and I do not have the sources of afxrendertarget.h locally. 我正在AppVeyor上进行编译,并且本地没有afxrendertarget.h的源。 How can I download the Windows SDK for header inspection on Ubuntu? 如何下载Windows SDK以便在Ubuntu上进行标头检查?

atlmfc\include\afxrendertarget.h(142): warning C4003: not enough actual parameters for macro 'IsNull' [C:\projects\pgpfone\src\win32\PGPfone.vcxproj]

The first error provides a couple of clues: 第一个错误提供了一些线索:

  • line # 142 in afxrendertarget.h is the inline definition of member function BOOL IsNull() const of CD2DSizeF ; 线# 142afxrendertarget.h是成员函数的一字形定义BOOL IsNull() constCD2DSizeF ;

  • C4003 refers to an illegal expansion of macro IsNull . C4003指代宏IsNull的非法扩展。

This indicates that some other non-MFC header file #define 'sa macro IsNull , and when that header is included before (the MFC header file which includes) afxrendertarget.h the IsNull macro breaks the IsNull member function declaration. 这表明其他一些非MFC头文件#define是一个宏IsNull ,并且在该头包含在afxrendertarget.h之前(包括MFC头文件)的afxrendertarget.hIsNull宏会破坏IsNull成员函数声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM