Hi,
We use xll+ from https://www.planatechsolutions.com/xllplus/ to produce an Excel addin providing new Excel functions.
We have been able to use CppCheck up to version 1.89.
With versions after 1.89 we get the msg
" There is an unknown macro here somewhere. Configuration is required. If IMPLEMENT_XLLFN4 is a macro then please configure it. "
for each code module and then no checks are performed for that code module.
The function code below includes header file #include "showerror.h", which includes header file #include <xllplus.h> ,
which includes header file #include <xlpfuncinit.h> which contains the following definition.</xlpfuncinit.h></xllplus.h>
The module containg function code which produces error
//showerror.cpp:DefinestheinitializationroutinesfortheDLL.//#ifdef XLL_LIB_MFC#include "stdafx.h"#endif#include "showerror.h"#ifdef _DEBUG#ifdef XLL_LIB_MFC#define new DEBUG_NEW#endif#undef THIS_FILEstaticcharTHIS_FILE[]=__FILE__;#endif///////////////////////////////////////////////////////////////////////////////CshowerrorApp#ifdef XLL_LIB_MFCBEGIN_MESSAGE_MAP(CshowerrorApp,CXllApp)//{{AFX_MSG_MAP(CshowerrorApp)//NOTE-theClassWizardwilladdandremovemappingmacroshere.//DONOTEDITwhatyouseeintheseblocksofgeneratedcode!//}}AFX_MSG_MAPEND_MESSAGE_MAP()#endif///////////////////////////////////////////////////////////////////////////////CshowerrorAppconstructionCshowerrorApp::CshowerrorApp(){//TODO:addconstructioncodehere,//PlaceallsignificantinitializationinInitInstance}///////////////////////////////////////////////////////////////////////////////TheoneandonlyCshowerrorAppobjectCshowerrorApptheApp;/*static*/LPCTSTRCshowerrorApp::m_pszDefName=_T("showerror");BOOLCshowerrorApp::InitInstance(){//Callthebaseclassif(!CXllApp::InitInstance())returnFALSE;//Setthenameofthelibrarytothedefaultvaluem_stName=m_pszDefName;//AddthestaticallydefinedfunctionspecificationsAddStaticFns();//TODO:AddyourspecializedcodeherereturnTRUE;}intCshowerrorApp::ExitInstance(){//TODO:Addyourspecializedcodehere(thencallthebaseclass)returnCXllApp::ExitInstance();}BOOLCshowerrorApp::OnXllOpenEx(){//TODO:Allocateanyapplication-levelresourcesreturnTRUE;}voidCshowerrorApp::OnXllClose(){//TODO:Cleanupanyapplication-levelresources}///////////////////////////////////////////////////////////////////////////////Exportedfunctions//TODO:Addyourownadd-infunctionsandtheirassociated//macroshere//Function:NewFn1//Purpose://{{XLP_SRC(NewFn1)//NOTE-theFunctionWizardwilladdandremovemappingcodehere.//DONOTEDITwhatyouseeintheseblocksofgeneratedcode!#pragma region NewFn1 support codeIMPLEMENT_XLLFN4(NewFn1,NewFn1_4,NewFn1_12,"RJ","UJ$",L"NewFn1",0,L"Arg"L"1",0,L"14",0,L"",0,L"\0",0,0,L"{NewFn1,,,{},14,1,1,U,{{0,{Arg1,"L"Int,0,,,,,,}}},{},3,,0,0,,,,0,0}",1,0,0)CXlOper*NewFn1_Impl(CXlOper&,long);extern"C"__declspec(dllexport)LPXLOPER12NewFn1_12(longArg1){XLL_FIX_STATE;CXlOperxloResult;try{CXlStructuredExceptionHandler_seh_;xloResult.HandleResult(NewFn1_Impl(xloResult,Arg1));}catch(constCXlRuntimeException&ex){CXllApp::Instance()->DisplayException(xloResult,ex);}XLP_CATCH_CLR_EXCEPTIONS_TO(xloResult)returnxloResult.Ret12();}extern"C"__declspec(dllexport)LPXLOPER4NewFn1_4(longArg1){XLL_FIX_STATE;CXlOperxloResult;try{CXlStructuredExceptionHandler_seh_;xloResult.HandleResult(NewFn1_Impl(xloResult,Arg1));}catch(constCXlRuntimeException&ex){CXllApp::Instance()->DisplayException(xloResult,ex);}XLP_CATCH_CLR_EXCEPTIONS_TO(xloResult)returnxloResult.Ret4();}#pragma endregionCXlOper*NewFn1_Impl(CXlOper&xloResult,longArg1){//Endofgeneratedcode//}}XLP_SRC//TODO-setthevalueofxloResult,orreturnanothervalue//usingCXlOper::RetXXX()orthrowaCXlRuntimeException.returnxloResult.Ret();}
Hi Daniel,
Thanks for your response .
I've created a cfg file with your statements and placed it in the cfg folder.
How do I use it with the gui cppcheck?
Rob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
We use xll+ from https://www.planatechsolutions.com/xllplus/ to produce an Excel addin providing new Excel functions.
We have been able to use CppCheck up to version 1.89.
With versions after 1.89 we get the msg
" There is an unknown macro here somewhere. Configuration is required. If IMPLEMENT_XLLFN4 is a macro then please configure it. "
for each code module and then no checks are performed for that code module.
The function code below includes header file #include "showerror.h", which includes header file #include <xllplus.h> ,
which includes header file #include <xlpfuncinit.h> which contains the following definition.</xlpfuncinit.h></xllplus.h>
The module containg function code which produces error
Last edit: Daniel Marjamäki 2020-09-27
I recommend that you create a "xllplus.cfg" file. Here is a start:
That solves your problem:
Using the file:
If you configure some xllplus macros and functions then feel free to share your xllplus.cfg with us. I would be happy to distribute it in Cppcheck.
Hi Daniel,
Thanks for your response .
I've created a cfg file with your statements and placed it in the cfg folder.
How do I use it with the gui cppcheck?
Rob
in the gui, create a project file.
in the "Types and Functions" tab, select all configurations that you use.
if you have a custom cfg file, you can put it in the same folder as the project file is in.