在Qmake之后运行make时编译错误

时间:2018-05-28 14:42:35

标签: c++ qt makefile qmake

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

当运行Qmake everthings似乎很好,但是在运行中让我得到以下错误:

INSERT INTO foo (data) VALUES ('asdf');
-- ERROR: null value in column "a" violates not-null constraint

SELECT make_into_serial('foo', 'a');
INSERT INTO foo (data) VALUES ('asdf');
-- OK: 1 row(s) affected

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

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

生成的makefile如下所示:

######################################################################
# 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

我的研究表明,inculude路径肯定有问题,但我指定的路径是我的c ++ includepath。

stdlib.h可以在以下网址找到:

#############################################################################
# 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

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

1 个答案:

答案 0 :(得分:0)

  

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

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相同的问题。)