GlobalProtect-openconnect icon indicating copy to clipboard operation
GlobalProtect-openconnect copied to clipboard

error: #include expects "FILENAME" or <FILENAME>

Open WorldsEndless opened this issue 3 years ago • 3 comments

When attempting to follow the OpenSUSE instructions, having installed the pre-requisites and following the documentation, I hit the following point, and the build fails (I am on Tumbleweed, a version of OpenSUSE):

$ make
cd GPClient/ && make -f Makefile 
make[1]: Entering directory '/home/torysa/workspace/Misc/GlobalProtect-openconnect/GPClient'
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQAPPLICATION_CLASS=QApplication -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include/QtDBus -I/usr/include -I../singleapplication -I../plog/include -I. -I. -o singleapplication.o ../singleapplication/singleapplication.cpp
In file included from ../singleapplication/singleapplication.cpp:33:
../singleapplication/singleapplication.h:33:10: error: #include expects "FILENAME" or <FILENAME>
   33 | #include QT_STRINGIFY(QAPPLICATION_CLASS)
      |          ^~~~~~~~~~~~
../singleapplication/singleapplication.h:43:1: error: expected class-name before ‘{’ token
   43 | {
      | ^
<command-line>: error: ‘QApplication’ does not name a type
../singleapplication/singleapplication.h:46:13: note: in expansion of macro ‘QAPPLICATION_CLASS’
   46 |     typedef QAPPLICATION_CLASS app_t;
      |             ^~~~~~~~~~~~~~~~~~
../singleapplication/singleapplication.cpp: In constructor ‘SingleApplication::SingleApplication(int&, char**, bool, SingleApplication::Options, int)’:
../singleapplication/singleapplication.cpp:44:7: error: class ‘SingleApplication’ does not have any field named ‘app_t’
   44 |     : app_t( argc, argv ), d_ptr( new SingleApplicationPrivate( this ) )
      |       ^~~~~
../singleapplication/singleapplication.cpp:110:107: error: ‘static void QThread::sleep(long unsigned int)’ is protected within this context
  110 |         QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( qrand() ) / RAND_MAX * 10 ) );
      |                                                                                                           ^
In file included from /usr/include/QtCore/QThread:1,
                 from ../singleapplication/singleapplication.cpp:24:
/usr/include/QtCore/qthread.h:115:17: note: declared protected here
  115 |     static void sleep(unsigned long);
      |                 ^~~~~
make[1]: *** [Makefile:375: singleapplication.o] Error 1
make[1]: Leaving directory '/home/torysa/workspace/Misc/GlobalProtect-openconnect/GPClient'
make: *** [Makefile:40: sub-GPClient-make_default] Error 2

WorldsEndless avatar May 11 '21 14:05 WorldsEndless

I had this issue in Ubuntu 18.04 and resolved it by messing around with the qt4 and qt5 base and devel packages until qt5 was installed correctly. I suspect if you check qmake --version you'll find it's trying to use qt4.

mjpelmear avatar Sep 03 '21 16:09 mjpelmear

Just in case you have still the problem, or for anyone living in a less than perfect world :) In may case I had both qt4 and qt5 installed and the same error compiling. I ended up make compilation work by changing the: qmake CONFIG+=release with qmake-qt5 CONFIG+=release

Be sure to clean everything before you do this if you started with qtmake and get the error. I mean: cd .. rm -fr GlobalProtect-openconnect/ git clone https://github.com/yuezk/GlobalProtect-openconnect.git cd GlobalProtect-openconnect git submodule update --init qmake-qt5 CONFIG+=release make

then follow usual instruction to install and run.

Pigi-102 avatar Sep 15 '21 07:09 Pigi-102

@Pigi-102 Thanks for your help. And I'm working on migrating it from qmake to cmake which can unify the build process.

yuezk avatar Sep 15 '21 07:09 yuezk