Why when i build the project at that time why compiler gives error ?
-
I have created multiple .pro file to create my project
Here i have my main pro file content is
TEMPLATE = SUBDIRS SUBDIRS += \ App \ Components ######################################################################### # Specify dependencies App.depends = Components
The first sub dir project App's content is
######################################################################### # Define project specific QT settings TEMPLATE = app TARGET = App QT += qml QT += quick QT += core QT += widgets QT += websockets CONFIG += c++17 DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 RESOURCES += \ Gui/qml.qrc QML_IMPORT_PATH += $$PWD/Gui/ SOURCES += \ Main.cpp INCLUDEPATH += $$PWD/../Components INCLUDEPATH += $$PWD/../Components/Utility DEPENDPATH += $$PWD/../Components
And the second subdir project content is
TEMPLATE = app QT += quick QT += core QT += websockets QT += widgets CONFIG += c++17 CONFIG += staticlib DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 HEADERS += \ MainApplication.h \ Utility/QmlEngineUtility.h SOURCES += \ MainApplication.cpp \ Utility/QmlEngineUtility.cpp
Errors
:-1: warning: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory :-1: error: No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'. Stop. 14:31:07: Running steps for project UiDirectoryStructure... 14:31:07: Starting: "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" /home/host/HOST/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/UiDirectoryStructure.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS] QIODevice::write: device not open 14:31:07: The process "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" exited normally. 14:31:07: Starting: "/usr/bin/make" -f /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile qmake_all make: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory make: *** No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'. Stop. 14:31:07: The process "/usr/bin/make" exited with code 2. Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit) When executing step "qmake" 14:31:07: Elapsed time: 00:00.
Can any body help me how to resolve this error ?
-
TEMPLATE = subdirs SUBDIRS += \ App \ Components # Specify dependencies App.depends = Components
The first sub dir project App's content is
######################################################################### # Define project specific QT settings TEMPLATE = app TARGET = App QT += qml QT += quick QT += core QT += widgets QT += websockets CONFIG += c++17 DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 RESOURCES += \ Gui/qml.qrc QML_IMPORT_PATH += $$PWD/Gui/ SOURCES += \ Main.cpp INCLUDEPATH += $$PWD/../Components INCLUDEPATH += $$PWD/../Components/Utility DEPENDPATH += $$PWD/../Components
And the second subdir project content is ```
TEMPLATE = app
QT += quick
QT += core
QT += websockets
QT += widgetsCONFIG += c++17 CONFIG += staticlib DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 HEADERS += \ MainApplication.h \ Utility/QmlEngineUtility.h SOURCES += \ MainApplication.cpp \ Utility/QmlEngineUtility.cpp
@Qt-embedded-developer I do not understand your second subproject PRO file. It uses
TEMPLATE = app
and simultaneously
CONFIG += staticlib
The CONFIG option staticlib means,
The target is a static library (lib only). The proper compiler flags will automatically be added to the project.
The target is either an application or a library, not both.
-
I have created multiple .pro file to create my project
Here i have my main pro file content is
TEMPLATE = SUBDIRS SUBDIRS += \ App \ Components ######################################################################### # Specify dependencies App.depends = Components
The first sub dir project App's content is
######################################################################### # Define project specific QT settings TEMPLATE = app TARGET = App QT += qml QT += quick QT += core QT += widgets QT += websockets CONFIG += c++17 DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 RESOURCES += \ Gui/qml.qrc QML_IMPORT_PATH += $$PWD/Gui/ SOURCES += \ Main.cpp INCLUDEPATH += $$PWD/../Components INCLUDEPATH += $$PWD/../Components/Utility DEPENDPATH += $$PWD/../Components
And the second subdir project content is
TEMPLATE = app QT += quick QT += core QT += websockets QT += widgets CONFIG += c++17 CONFIG += staticlib DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 HEADERS += \ MainApplication.h \ Utility/QmlEngineUtility.h SOURCES += \ MainApplication.cpp \ Utility/QmlEngineUtility.cpp
Errors
:-1: warning: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory :-1: error: No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'. Stop. 14:31:07: Running steps for project UiDirectoryStructure... 14:31:07: Starting: "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" /home/host/HOST/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/UiDirectoryStructure.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS] QIODevice::write: device not open 14:31:07: The process "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" exited normally. 14:31:07: Starting: "/usr/bin/make" -f /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile qmake_all make: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory make: *** No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'. Stop. 14:31:07: The process "/usr/bin/make" exited with code 2. Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit) When executing step "qmake" 14:31:07: Elapsed time: 00:00.
Can any body help me how to resolve this error ?
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
QIODevice::write: device not openLooks like qmake is not able to write in the build folder.
Is your drive full? Or mounted read-only? Or corrupted? -
I have created multiple .pro file to create my project
Here i have my main pro file content is
TEMPLATE = SUBDIRS SUBDIRS += \ App \ Components ######################################################################### # Specify dependencies App.depends = Components
The first sub dir project App's content is
######################################################################### # Define project specific QT settings TEMPLATE = app TARGET = App QT += qml QT += quick QT += core QT += widgets QT += websockets CONFIG += c++17 DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 RESOURCES += \ Gui/qml.qrc QML_IMPORT_PATH += $$PWD/Gui/ SOURCES += \ Main.cpp INCLUDEPATH += $$PWD/../Components INCLUDEPATH += $$PWD/../Components/Utility DEPENDPATH += $$PWD/../Components
And the second subdir project content is
TEMPLATE = app QT += quick QT += core QT += websockets QT += widgets CONFIG += c++17 CONFIG += staticlib DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 HEADERS += \ MainApplication.h \ Utility/QmlEngineUtility.h SOURCES += \ MainApplication.cpp \ Utility/QmlEngineUtility.cpp
Errors
:-1: warning: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory :-1: error: No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'. Stop. 14:31:07: Running steps for project UiDirectoryStructure... 14:31:07: Starting: "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" /home/host/HOST/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/UiDirectoryStructure.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS] QIODevice::write: device not open 14:31:07: The process "/home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake" exited normally. 14:31:07: Starting: "/usr/bin/make" -f /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile qmake_all make: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile: No such file or directory make: *** No rule to make target '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile'. Stop. 14:31:07: The process "/usr/bin/make" exited with code 2. Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit) When executing step "qmake" 14:31:07: Elapsed time: 00:00.
Can any body help me how to resolve this error ?
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there? Show your pro file(s).
-
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there? Show your pro file(s).
@jsulm Hi i have update the my question and shown the .pro file there.
Can you guide what changes i need to make so it works correctly ?
-
@jsulm Hi i have update the my question and shown the .pro file there.
Can you guide what changes i need to make so it works correctly ?
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
Can you guide what changes i need to make so it works correctly ?
First answer questions I asked before:
- Is your drive full?
- Or mounted read-only?
- Or corrupted?
- Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there?
-
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
Can you guide what changes i need to make so it works correctly ?
First answer questions I asked before:
- Is your drive full?
- Or mounted read-only?
- Or corrupted?
- Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there?
@jsulm said in Why when i build the project at that time why qmke gives error ?:
Is your drive full?
Or mounted read-only?
Or corrupted?
Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there?1] No
2] no
3] no. different project work but just this project not working -
@jsulm said in Why when i build the project at that time why qmke gives error ?:
Is your drive full?
Or mounted read-only?
Or corrupted?
Also the [TEMPLATE SUBDIRS] part in the path is strange: why is it there?1] No
2] no
3] no. different project work but just this project not working@Qt-embedded-developer I asked 4 questions...
Again: why is there "[TEMPLATE SUBDIRS]" in /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS] ? -
@Qt-embedded-developer I asked 4 questions...
Again: why is there "[TEMPLATE SUBDIRS]" in /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS] ?@jsulm Actually I have take reference of other project. And i have to create structure of that project like it.
So my answer is due to reference. but technically i don't know it's correct or not . But I want to know how to make it correct.
So initially i take emty qmake project. and then in same project manually wrote subdir project because it's in reference project.
So Actually i have to create structure like
MainProject
-mainproj.pro
Appproject(template App)
-App.pro
-sources
main.cpp
-qrc
Main.qml
Componentproject (template lib)
-Component.pro
-sources- common
-file.cpp
-Header - common
-file.h
MainApplication.cpp
MainApplication.h
- common
-
@jsulm Actually I have take reference of other project. And i have to create structure of that project like it.
So my answer is due to reference. but technically i don't know it's correct or not . But I want to know how to make it correct.
So initially i take emty qmake project. and then in same project manually wrote subdir project because it's in reference project.
So Actually i have to create structure like
MainProject
-mainproj.pro
Appproject(template App)
-App.pro
-sources
main.cpp
-qrc
Main.qml
Componentproject (template lib)
-Component.pro
-sources- common
-file.cpp
-Header - common
-file.h
MainApplication.cpp
MainApplication.h
Do you really have "(template XXX)" as part of the folder name ? If so, remove that.
- common
-
Do you really have "(template XXX)" as part of the folder name ? If so, remove that.
@SGaist Actually i want understand that how you get thought that "template XXX". because i can not able to find where exactly the change is needed.
i don't have folder template XXX
@SGaist @jsulm I want to become expert of creating any type of project structure. So can you guide how i should start ?
-
@SGaist Actually i want understand that how you get thought that "template XXX". because i can not able to find where exactly the change is needed.
i don't have folder template XXX
@SGaist @jsulm I want to become expert of creating any type of project structure. So can you guide how i should start ?
@Qt-embedded-developer Show the exact structure you have on disk.
As @jsulm already pointed the fact that there's
[TEMPLATE SUBDIRS]
that appears in your compiler logs is suspicious. Do you have that string anywhere in your project files ? -
@SGaist Actually i want understand that how you get thought that "template XXX". because i can not able to find where exactly the change is needed.
i don't have folder template XXX
@SGaist @jsulm I want to become expert of creating any type of project structure. So can you guide how i should start ?
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
i don't have folder template XXX
Then what is this:
WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
?
-
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
i don't have folder template XXX
Then what is this:
WARNING: Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
?
@jsulm @Qt-embedded-developer , @jsulm, @SGaist
Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
TEMPLATE = SUBDIRS
Setup SUBDIRS template failed in QtCreator from 10 years ago (good Qt answers never fade!):
It should be
TEMPLATE = subdirs
, notSUBDIR
Use
TEMPLATE = subdirs
instead ofTEMPLATE = SUBDIRS
, i.e. not upper case letters..:)
-
@jsulm @Qt-embedded-developer , @jsulm, @SGaist
Unable to generate output for: /home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile [TEMPLATE SUBDIRS]
TEMPLATE = SUBDIRS
Setup SUBDIRS template failed in QtCreator from 10 years ago (good Qt answers never fade!):
It should be
TEMPLATE = subdirs
, notSUBDIR
Use
TEMPLATE = subdirs
instead ofTEMPLATE = SUBDIRS
, i.e. not upper case letters..:)
@JonB said in Why when i build the project at that time why compiler gives error ?:
when now i am run this complete project i am getting below errors
On the issue tab it give the below error:
:-1: error: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b):-1: error: undefined reference to `main'
:-1: error: collect2: error: ld returned 1 exit status
:-1: error: [Makefile:253: Components] Error 1
Compiler gives the below errors:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function
_start': (.text+0x1b): undefined reference to
main'
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
make[1]: *** [Makefile:253: Components] Error 1
make: *** [Makefile:73: sub-Components-make_first] Error 2
14:54:56: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
When executing step "Make"I want to become expert of creating any type of project structure. So can anybody guide how i should start ?
@jsulm, @SGaist @JonB Thank you for several time contribution in several post of mine
-
@JonB said in Why when i build the project at that time why compiler gives error ?:
when now i am run this complete project i am getting below errors
On the issue tab it give the below error:
:-1: error: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b):-1: error: undefined reference to `main'
:-1: error: collect2: error: ld returned 1 exit status
:-1: error: [Makefile:253: Components] Error 1
Compiler gives the below errors:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function
_start': (.text+0x1b): undefined reference to
main'
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/home/host/HOST/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
make[1]: *** [Makefile:253: Components] Error 1
make: *** [Makefile:73: sub-Components-make_first] Error 2
14:54:56: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
When executing step "Make"I want to become expert of creating any type of project structure. So can anybody guide how i should start ?
@jsulm, @SGaist @JonB Thank you for several time contribution in several post of mine
@Qt-embedded-developer
The system'slib64/crt1.o
is the entry point when your program is started. That will call its_start()
function, and that in turn will expect to call your program'smain()
. But the error message says it cannot find any suchmain()
. Which implies your linker command does not include your main program.I have never used a
subdirs
project, sounds like that is not correctly picking up your main program. You could show the complete linker command (Compile Output pane, the last line where it does the linking). Probably needs someone who knows howsubdirs
project is supposed to work.... -
@Qt-embedded-developer
The system'slib64/crt1.o
is the entry point when your program is started. That will call its_start()
function, and that in turn will expect to call your program'smain()
. But the error message says it cannot find any suchmain()
. Which implies your linker command does not include your main program.I have never used a
subdirs
project, sounds like that is not correctly picking up your main program. You could show the complete linker command (Compile Output pane, the last line where it does the linking). Probably needs someone who knows howsubdirs
project is supposed to work....@JonB Hi My compiler out put is :
cd Components/ && ( test -e Makefile || /home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake -o Makefile /home/host/P_host/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/Components/Components.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug ) && /usr/bin/make -f Makefile
make[1]: Entering directory '/home/host/P_host/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
g++ -o Components MainApplication.o QmlEngineUtility.o moc_MainApplication.o moc_QmlEngineUtility.o /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Quick.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Widgets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Gui.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5QmlModels.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Qml.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5WebSockets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Network.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function_start': (.text+0x1b): undefined reference to
main'
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/home/host/P_host/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
make[1]: *** [Makefile:253: Components] Error 1
make: *** [Makefile:73: sub-Components-make_first] Error 2
16:27:37: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
When executing step "Make"
16:27:37: Elapsed time: 00:00.I can able to see that my app folder's main.cpp not included when below command :
g++ -o Components MainApplication.o QmlEngineUtility.o moc_MainApplication.o moc_QmlEngineUtility.o /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Quick.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Widgets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Gui.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5QmlModels.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Qml.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5WebSockets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Network.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread
try to build. but i don't know how to allow my main.cpp also. why it automatically not get taken. becuase my main is in main.cpp
i have created my source code such that the except main.cpp of App project is in Component project. so when i need to write unittest then it help. and as well as i want to link my component connect with app project using static library.
So what changes i need to do ?
-
@JonB Hi My compiler out put is :
cd Components/ && ( test -e Makefile || /home/host/Qt5.15.2/5.15.2/gcc_64/bin/qmake -o Makefile /home/host/P_host/TWS_11_02_2024/14FEB2024/UiDirectoryStructure/Components/Components.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug ) && /usr/bin/make -f Makefile
make[1]: Entering directory '/home/host/P_host/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
g++ -o Components MainApplication.o QmlEngineUtility.o moc_MainApplication.o moc_QmlEngineUtility.o /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Quick.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Widgets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Gui.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5QmlModels.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Qml.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5WebSockets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Network.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/../../../../lib64/crt1.o: in function_start': (.text+0x1b): undefined reference to
main'
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/home/host/P_host/TWS_11_02_2024/14FEB2024/build-UiDirectoryStructure-Desktop_Qt_5_15_2_GCC_64bit-Debug/Components'
make[1]: *** [Makefile:253: Components] Error 1
make: *** [Makefile:73: sub-Components-make_first] Error 2
16:27:37: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project UiDirectoryStructure (kit: Desktop Qt 5.15.2 GCC 64bit)
When executing step "Make"
16:27:37: Elapsed time: 00:00.I can able to see that my app folder's main.cpp not included when below command :
g++ -o Components MainApplication.o QmlEngineUtility.o moc_MainApplication.o moc_QmlEngineUtility.o /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Quick.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Widgets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Gui.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5QmlModels.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Qml.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5WebSockets.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Network.so /home/host/Qt5.15.2/5.15.2/gcc_64/lib/libQt5Core.so -lGL -lpthread
try to build. but i don't know how to allow my main.cpp also. why it automatically not get taken. becuase my main is in main.cpp
i have created my source code such that the except main.cpp of App project is in Component project. so when i need to write unittest then it help. and as well as i want to link my component connect with app project using static library.
So what changes i need to do ?
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
try to build. but i don't know how to allow my main.cpp also. why it automatically not get taken. becuase my main is in main.cpp
And that is your problem. Like I said, I have never used a
subdirs
project. But I imagine that has some "main" project, which has yourmain.cpp
in it. Are you building that top-level, main project, or are you perhaps only building one of the subprojects, which will not have amain
? -
@Qt-embedded-developer said in Why when i build the project at that time why compiler gives error ?:
try to build. but i don't know how to allow my main.cpp also. why it automatically not get taken. becuase my main is in main.cpp
And that is your problem. Like I said, I have never used a
subdirs
project. But I imagine that has some "main" project, which has yourmain.cpp
in it. Are you building that top-level, main project, or are you perhaps only building one of the subprojects, which will not have amain
? -
Share your other
.pro
files so we can see what is going on. -
TEMPLATE = subdirs SUBDIRS += \ App \ Components # Specify dependencies App.depends = Components
The first sub dir project App's content is
######################################################################### # Define project specific QT settings TEMPLATE = app TARGET = App QT += qml QT += quick QT += core QT += widgets QT += websockets CONFIG += c++17 DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 RESOURCES += \ Gui/qml.qrc QML_IMPORT_PATH += $$PWD/Gui/ SOURCES += \ Main.cpp INCLUDEPATH += $$PWD/../Components INCLUDEPATH += $$PWD/../Components/Utility DEPENDPATH += $$PWD/../Components
And the second subdir project content is ```
TEMPLATE = app
QT += quick
QT += core
QT += websockets
QT += widgetsCONFIG += c++17 CONFIG += staticlib DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 HEADERS += \ MainApplication.h \ Utility/QmlEngineUtility.h SOURCES += \ MainApplication.cpp \ Utility/QmlEngineUtility.cpp