如何将网络模块添加到QT pro文件中?

问题描述 投票:-2回答:1

这是我的.pro文件的样子。

QT       += core gui
QT       += network
QT       += core
CONFIG   += staticlib
CONFIG   += qml_debug
CONFIG   += qtc_runnable

TEMPLATE = lib

INCLUDEPATH += ...path/Views/


greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

DEFINES += QT_DEPRECATED_WARNINGS

SOURCES += \
    main.cpp \
    file.cpp \
    widget.cpp

HEADERS += \
    file.h \
    widget.h

FORMS += \
    widget.ui

qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

我试着重新运行qmake,但什么也没做。 我还是一直收到这个错误。

:-1: error: You need to set an executable in the custom run configuration.

我相信这个错误是由于我将库添加到pro文件中的方式造成的。

编辑:我知道关于未使用的库的问题。

07:47:59: Running steps for project project1...
07:47:59: Configuration unchanged, skipping qmake step.
07:47:59: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe" 
    C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug/project1.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I..\project1 -I. -I..\..\..\..\Qt\5.15.0\msvc2019_64\include -I..\..\..\..\Qt\5.15.0\msvc2019_64\include\QtWidgets -I..\..\..\..\Qt\5.15.0\msvc2019_64\include\QtGui -I..\..\..\..\Qt\5.15.0\msvc2019_64\include\QtANGLE -I..\..\..\..\Qt\5.15.0\msvc2019_64\include\QtNetwork -I..\..\..\..\Qt\5.15.0\msvc2019_64\include\QtCore -Idebug -I. -I/include -I..\..\..\..\Qt\5.15.0\msvc2019_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\user\AppData\Local\Temp\file.obj.10608.16.jom
file.cpp
C:\Users\user\Documents\project1\file.cpp(62) : warning C4700: uninitialized local variable 's' used
C:\Users\user\Documents\project1\file.cpp(93) : warning C4700: uninitialized local variable 's' used
      /OUT:debug\project1.exe @C:\Users\user\AppData\Local\Temp\project1.exe.10608.953.jom
The system cannot find the path specified.
jom: C:\Users\user\Documents\build-project1-Desktop_Qt_5_15_0_MSVC2019_64bit-Debug\Makefile.Debug [debug\project1.exe] Error 1
jom: C:\Users\user\Documents\build-project1-Desktop_Qt_5_15_0_MSVC2019_64bit-Debug\Makefile [debug] Error 2
07:48:00: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project project1 (kit: Desktop Qt 5.15.0 MSVC2019 64bit)
When executing step "Make"

我知道未使用的变量警告.我确实检查了这些位置,我能够找到两个cmake文件。

c++ qt qt-creator
1个回答
0
投票

这个错误与pro文件无关。这是我代码中的语法错误。

© www.soinside.com 2019 - 2024. All rights reserved.