在Qmake之后运行make时编译错误 [英] Compile error when running make after Qmake

查看:273
本文介绍了在Qmake之后运行make时编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从github编译一些东西: https://github.com/com2m/anki-overdrive-goes-iot/

I'm trying to compile something from github: https://github.com/com2m/anki-overdrive-goes-iot/

运行Qmake时一切正常,但在运行时却出现以下错误:

When Running Qmake everthings seems fine, but whe in run make i get the follwoing error:

g++ -c -pipe -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_BLUETOOTH_LIB -DQT_CORE_LIB -I. -isystem /usr/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtBluetooth -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o main.o src/main.cpp
In file included from /usr/include/c++/7/bits/stl_algo.h:59:0,
                 from /usr/include/c++/7/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:109,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/qcoreapplication.h:43,
                 from /usr/include/x86_64-linux-gnu/qt5/QtCore/QCoreApplication:1,
                 from src/main.cpp:6:
/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
Makefile:497: recipe for target 'main.o' failed
make: *** [main.o] Error 1

我正在运行qmake的文件是带有以下内容的ankidrive.pro文件.

The File i'm running qmake on is the ankidrive.pro file with the follwing content.

######################################################################
# Automatically generated by qmake (3.0) Thu Sep 29 10:34:51 2016
######################################################################

QT += bluetooth
QT += core
QT -= gui

CONFIG += c++11
CONFIG += debug

TEMPLATE = app
TARGET = build/ankioverdrive
#INCLUDEPATH += .

LIBS += -lmosquittopp

LIBS += -L/usr/lib

INCLUDEPATH += /usr/include/

# Input
SOURCES += src/main.cpp \
    src/bluetoothcontroller.cpp \
    src/ankimessage.cpp \
    src/trackpiece.cpp \
    src/track.cpp \
    src/mqttclient.cpp \
    src/json.cpp \
    src/drivemode.cpp \
    src/joystick.cc \
    src/gamepadmanager.cpp \
    src/ankicar.cpp \
    src/racecar.cpp \
    src/tragediyimplementation.cpp

HEADERS += \
    src/headers/bluetoothcontroller.h \
    src/headers/ankimessage.h \
    src/headers/trackpiece.h \
    src/headers/track.h \
    src/headers/mqttclient.h \
    src/headers/json.h \
    src/headers/drivemode.h \
    src/headers/joystick.hh \
    src/headers/gamepadmanager.h \
    src/headers/ankicar.h \
    src/headers/racecar.h \
    src/headers/tragediyimplementation.h

生成的生成文件如下所示:

The makefile generated starts like this:

#############################################################################
# Makefile for building: build/ankioverdrive
# Generated by qmake (3.1) (Qt 5.9.5)
# Project:  ankioverdrive.pro
# Template: app
# Command: /usr/lib/qt5/bin/qmake -o Makefile ankioverdrive.pro
#############################################################################

MAKEFILE      = Makefile

####### Compiler, tools and options

CC            = gcc
CXX           = g++
DEFINES       = -DQT_BLUETOOTH_LIB -DQT_CORE_LIB
CFLAGS        = -pipe -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS      = -pipe -g -std=gnu++11 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH       = -I. -isystem /usr/include -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtBluetooth -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++
QMAKE         = /usr/lib/qt5/bin/qmake
DEL_FILE      = rm -f
CHK_DIR_EXISTS= test -d
MKDIR         = mkdir -p
COPY          = cp -f
COPY_FILE     = cp -f
COPY_DIR      = cp -f -R
INSTALL_FILE  = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR   = cp -f -R
QINSTALL      = /usr/lib/qt5/bin/qmake -install qinstall
QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe
DEL_FILE      = rm -f
SYMLINK       = ln -f -s
DEL_DIR       = rmdir
MOVE          = mv -f
TAR           = tar -cf
COMPRESS      = gzip -9f
DISTNAME      = ankioverdrive1.0.0
DISTDIR = /home/renji/Projects/BachalorArbeit/anki-overdrive-goes-iot/.tmp/ankioverdrive1.0.0
LINK          = g++
LFLAGS        = -Wl,-rpath-link,/usr/lib/x86_64-linux-gnu
LIBS          = $(SUBLIBS) -lmosquittopp -L/usr/lib -lQt5Bluetooth -lQt5Core -lpthread 
AR            = ar cqs
RANLIB        = 
SED           = sed
STRIP         = strip

我的研究表明,包含路径一定存在问题,但是我分配的路径是我的c ++ includepath.

My research showed that there must be something wrong with the inculude path, but the path i assigned is my c++ includepath.

stdlib.h可以在以下位置找到:

The stdlib.h can be found under:

/usr/include/c++/7/stdlib.h

我正在运行 Kubuntu 18.04 ,并且库 build-essentials 已安装.

Im'm running Kubuntu 18.04 and the library build-essentials is already installed.

推荐答案

/usr/include/c ++/7/cstdlib:75:15:致命错误:stdlib.h:没有这样的文件或目录

/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory

sudo apt install g++ g++-5 libmosquittopp-dev libbluetooth-dev qtconnectivity5-dev

git clone https://github.com/com2m/anki-overdrive-goes-iot.git
cd anki-overdrive-goes-iot/
export QT_SELECT=5
qmake       // the Makefile is generated
            // Edit Makefile line 13 to CC = gcc-5
            // and line 14 to CXX = g++-5
make

没有错误.

您的错误:由于找不到g ++-7头文件/usr/include/c++/7/stdlib.h,我认为这是一个错误. (与g ++-6相同).

Your errors: I guess it's kind of a bug somewhere, since the g++-7 header /usr/include/c++/7/stdlib.h is not found ? (Same issue with g++-6.)

这篇关于在Qmake之后运行make时编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆