Linux Mint 18.1でLightScreenをコンパイルする

Linux Mint 18.1でLightScreenをコンパイルする

Linux Mint 18.1では、Linuxと互換性があると主張するアプリケーションをコンパイルする際に問題があります。アプリケーションはLightscreenと呼ばれます。コマンドを使用することを除いて、すべてがスムーズに進みますmake

これまでに行ったコマンドプロセスは次のとおりです。

以前のバージョンのライトスクリーンを使用しないと、次の結果が表示され、他のバージョンでは機能しないため、最初にQT 5.7をインストールする必要がありました。

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

そのため、最近のアップデートでサポートされていると推定されるQT 5.7をインストールしましたが、結果は次のとおりです。

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 $ 

エラーメッセージはなく、一般的なプロジェクトメッセージだけで、すべてが大丈夫だと思って続けました。 makeを実行しましたが、最初のエラーが発生しました。

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

私は何が間違っていましたか?私はLinuxでコンパイルするのが初めてで、多くのプログラムをコンパイルしましたが、それでも作業方法とコンパイル方法を理解できませんでした。ステップバイステップガイドは役に立ちますが、必ずしもそうする必要はありません。特に不要な場合はさらにそうです。

あらかじめご協力いただきありがとうございます。

編集:今別の問題が発生しました。これを実行すると、make次のような結果が出力されます。

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

ベストアンサー1

問題は<X11/X.h>(Linuxでコンパイルするときにのみ含まれます)で発生します。これは次のマクロを定義します。

#define Success 0

これは同じ名前の列挙型メンバーを妨げますScreenshot::Result::Success

この問題を解決するには、tools/screenshot.cppを開き、次の行を見つけます。

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

Xhを含めた後#undef Success

おすすめ記事