QT with Windows Filtering Platform
-
Hello,
I have to create GUI for my project written in VS in c++. It's small application which adds filters to block chosen web brower using WFP. I have GUI written in VS but i need to make it in QT. I'm trying to move my code from VS to QT creator. First problem i faced was affter including WFP library
In Visual studio my code looked:
@#pragma once#include <windows.h>
#include <fwpmu.h>
#include <rpc.h>
#include <winioctl.h>
#include <strsafe.h>
#include <stdio.h>
#include <guiddef.h>
#include <vcclr.h>
#include <AccCtrl.h>
#include <Aclapi.h>
#include <sddl.h>
#include <fstream>
#include <iostream>#pragma comment(lib, "fwpuclnt.lib")
#pragma comment(lib, "rpcrt4.lib")
#pragma comment(lib, "advapi32.lib")@After moving this to QT i get error:
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\ipsectypes.h:8: In file included from c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\ipsectypes.h:8:0,
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmtypes.h:9: from c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmtypes.h:9,
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmu.h:10: from c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmu.h:10,
C:\Qt\Qt5.2.0\Tools\QtCreator\bin\QTTrojan\GUI.cpp:2: from ..\QTTrojan\GUI.cpp:2:
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\iketypes.h:746: błąd: #endif without #if
#endif /* iketypes_h */
^c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmtypes.h:10: In file included from c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmtypes.h:10:0,
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmu.h:10: from c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmu.h:10,
C:\Qt\Qt5.2.0\Tools\QtCreator\bin\QTTrojan\GUI.cpp:2: from ..\QTTrojan\GUI.cpp:2:
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\iketypes.h:746: błąd: #endif without #if
#endif /* iketypes_h */
^c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmu.h:11: In file included from c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmu.h:11:0,
C:\Qt\Qt5.2.0\Tools\QtCreator\bin\QTTrojan\GUI.cpp:2: from ..\QTTrojan\GUI.cpp:2:
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\iketypes.h:746: błąd: #endif without #if
#endif /* iketypes_h */
^
C:\Qt\Qt5.2.0\Tools\QtCreator\bin\QTTrojan\GUI.cpp:4: In file included from ..\QTTrojan\GUI.cpp:4:0:C:\Qt\Qt5.2.0\Tools\QtCreator\bin\QTTrojan\interface.h:19: ostrzeżenie: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "fwpuclnt.lib")
^C:\Qt\Qt5.2.0\Tools\QtCreator\bin\QTTrojan\interface.h:20: ostrzeżenie: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "rpcrt4.lib")
^C:\Qt\Qt5.2.0\Tools\QtCreator\bin\QTTrojan\interface.h:21: ostrzeżenie: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "advapi32.lib")
^c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmtypes.h:10: In file included from c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmtypes.h:10:0,
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmu.h:10: from c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\fwpmu.h:10,
C:\Qt\Qt5.2.0\Tools\QtCreator\bin\QTTrojan\GUI.cpp:2: from ..\QTTrojan\GUI.cpp:2:
c:\qt\qt5.2.0\tools\mingw48_32\i686-w64-mingw32\include\iketypes.h:743: błąd: expected declaration before '}' token
}
^I've just started learning QT so im complete newbie. I've been searching internet for solution for more than 5 hour now. I would appreciate any help!
-
Hi and welcome to devnet,
AFAIK, there's no equivalent of "pragma comment" for gcc. You will have to either use MSVC or use the LIBS variable in your pro file to link to these libraries
Hope it helps