简体   繁体   中英

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.

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

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.

Is it possible with Visual C++ to get a macro-backtrace? I remember Clang or GCC has this feature.

Here is the full source: 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. How can I download the Windows SDK for header inspection on 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 ;

  • C4003 refers to an illegal expansion of macro 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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