2

I am having issues compiling a claimed to be Linux compatible application on Linux Mint 18.1. The application in particular is called Lightscreen. Everything has gone smoothly besides using the make command.

Here is the command process I have done so far:

I had to first install QT 5.7 because it wouldn't work with any other version unless I used an older version of lightscreen, as I would get this result:

Project ERROR: Unknown module(s) in QT: x11extras

So I went ahead and installed QT 5.7 which is claims to support in the most recent update, and this is the output:

nicholas@LinuxNick ~/bin/lightscreen $ /home/nicholas/.Qt/5.7/gcc_64/bin/qmake
Project MESSAGE: This project is using private headers and will therefore be tied to this specific Qt module build version.
Project MESSAGE: Running this project against other versions of the Qt modules may crash at any arbitrary point.
Project MESSAGE: This is not a bug, but a result of using Qt internals. You have been warned!
nicholas@LinuxNick ~/bin/lightscreen $ 

Suspecting everything was fine since there was no error messages but instead general Project messages, I continued. I ran make and there were my first errors.

In file included from tools/screenshot.cpp:45:0:
tools/screenshot.cpp: In member function ‘void Screenshot::save()’:
tools/screenshot.cpp:250:34: error: expected unqualified-id before numeric constant
             result = Screenshot::Success;
                                  ^
tools/screenshot.cpp:260:79: error: expected unqualified-id before numeric constant
   result = (QFile::rename(mUnloadFilename, fileName)) ? Screenshot::Success : S
                                                                     ^
tools/screenshot.cpp:260:79: error: expected ‘:’ before numeric constant
tools/screenshot.cpp:262:34: error: expected unqualified-id before numeric constant
             result = Screenshot::Success;
                                  ^
Makefile:5959: recipe for target 'screenshot.o' failed
make: *** [screenshot.o] Error 1

Am I doing something wrong? I am kinda new to compiling stuff on linux and while I compiled quite a few programs, I still haven't gotten the hang of stuff and how things are supposed to be compiled. A step by step guide would be helpful, but it doesn't have to be one, especially if it isn't needed.

Please, help, and thanks in advance.

EDIT: I am now experiencing a different problem. When I run make, this is the output:

g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DUGLOBALHOTKEY_NOEXPORT -DAPP_VERSION=\"2.5\" -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_X11EXTRAS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -I. -Itools/UGlobalHotkey -Itools/UGlobalHotkey -I../../.Qt/5.7/gcc_64/include -I../../.Qt/5.7/gcc_64/include/QtWidgets -I../../.Qt/5.7/gcc_64/include/QtMultimedia -I../../.Qt/5.7/gcc_64/include/QtGui/5.7.1 -I../../.Qt/5.7/gcc_64/include/QtGui/5.7.1/QtGui -I../../.Qt/5.7/gcc_64/include/QtX11Extras -I../../.Qt/5.7/gcc_64/include/QtGui -I../../.Qt/5.7/gcc_64/include/QtNetwork -I../../.Qt/5.7/gcc_64/include/QtSql -I../../.Qt/5.7/gcc_64/include/QtConcurrent -I../../.Qt/5.7/gcc_64/include/QtCore/5.7.1 -I../../.Qt/5.7/gcc_64/include/QtCore/5.7.1/QtCore -I../../.Qt/5.7/gcc_64/include/QtCore -I. -I. -I../../.Qt/5.7/gcc_64/mkspecs/linux-g++ -o os.o tools/os.cpp
tools/os.cpp: In function ‘QPair<QPixmap, QPoint> os::cursor()’:
tools/os.cpp:131:23: error: could not convert ‘QPoint(0, 0)’ from ‘QPoint’ to ‘QPair<QPixmap, QPoint>’
     return QPoint(0, 0);
                       ^
Makefile:5657: recipe for target 'os.o' failed
make: *** [os.o] Error 1
Ookinder
  • 319

1 Answers1

3

The problem comes from <X11/X.h> (only included when compiling to Linux). It defines the following macro:

#define Success 0

This interferes with an enum member of the same name, Screenshot::Result::Success.

To fix this, open tools/screenshot.cpp, and find the following lines:

#ifdef Q_OS_LINUX
    #include <QX11Info>
    #include <X11/X.h>
    #include <X11/Xlib.h>
#endif

After the include for X.h, add an #undef Success. This removes the conflicting macro.

  • I edited the question with additional information. This is after applying your fix. It got rid of that error, but I am still experiencing an issue. In QtCreator, this is the only error in the output. Thanks, by the way. Really appreciate your help. – Ookinder Jun 15 '17 at 22:22
  • Nevermind, I had a screwed up build. I re-installed Lightscreen, did your fix, and it seemed to have worked just perfectly fine. Thank you so much. – Ookinder Jun 16 '17 at 02:38