Cannot Open Source File no such file or directory
-
I apologize if this is the wrong place to post this question.
I have a project that I am trying to build within a subdirectory structure. The structure goes as follows:Project - Project.pro | Base | -base.pro | | | Object | | -object.pro | | | | | Dependency1 | | | - depend1.cpp | | | - depend1.hpp | | | | | Dependency2 | | - depend2.cpp | | - depend2.hpp | | | GUI | | - gui.pro | | ...Folders and their source files | | | Other Folders | - other .pro files | External | ExternalProj1 | ExternalProj2
And as of right now I am only trying to compile the Object's project. However, when I try to get it to compile, it simply gives me the error:
Cannot open source file: '..\..\..\Project\Base\Object\Dependency1\depend1.cpp' No such file or directory Cannot open source file: '..\..\..\Project\Base\Object\Dependency2\depend2.cpp' No such file or directory
I have tried searching around however most problems with this kind of related question seems to be missing header files which is not what the error is trying to convey here. I have tried making all sorts of modifications to
object.pro
,base.pro
, andProject.pro
however all of them have failed and I am kind of stuck on where I need to go from here.Project
is a subdir project, andBase
andExternal
are also subdir projects. I am not really sure what I need to modify from here in order to get this error to go away.Here is my
base.pro
:TEMPLATE = subdirs SUBDIRS += \ Object \ GUI \ Others...
And
object.pro
looks like this:TEMPLATE = lib TARGET = Object CONFIG += c++17 HEADERS += \ $$PWD/Dependency1/depend1.hpp \ $$PWD/Dependency2/depend2.hpp SOURCES += \ $$PWD/Dependency1/depend1.cpp \ $$PWD/Dependency2/depend2.cpp INCLUDEPATH += \ $$PWD/Dependency1 \ $$PWD/Dependency2
Project.pro
looks very similar tobase.pro
other than it has the subdirs ofBase
andExternal
. What am I doing wrong? I want to be able to figure this out now so I can fix them when I am trying to build the individual projects that are in theBase
Folder andExternal
folder.Compiler Output:
c1xx: fatal error C1083: Cannot open source file: '..\..\..\Project\Base\Object\Dependency1\depend1.cpp': No such file or directory depend1.cpp c1xx: fatal error C1083: Cannot open source file: '..\..\..\Project\Base\Object\Dependency2\depend2.cpp': No such file or directory jom: C:\Users\<USER>\Documents\Projects\build-Project-Desktop_Qt_5_12_1_MSVC2017_64bit-Debug\Base\Object\Makefile.Debug [debug\Dependency1.obj] Error 2 jom: C:\Users\<USER>\Documents\Projects\build-Project-Desktop_Qt_5_12_1_MSVC2017_64bit-Debug\Base\Object\Makefile.Debug [debug\Dependency2.obj] Error 2 c1xx: fatal error C1083: Cannot open source file: '..\..\..\Project\Base\Object\Dependency2\depend2.cpp': No such file or directory jom: C:\Users\<USER>\Documents\Projects\build-Project-Desktop_Qt_5_12_1_MSVC2017_64bit-Debug\Base\Object\Makefile [debug] Error 2 09:59:10: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2. Error while building/deploying project Project (kit: Desktop Qt 5.12.1 MSVC2017 64bit) When executing step "Make"
-
Hi and welcome to devnet,
I don't see anything fundamentally wrong with what you posted.
What I would do, is start smaller and go up step by step.
Start with just building the Object project. Then once it builds, go up one level and repeat until your reached Project. That way you first ensure that Object correctly builds without all the structure of a multilevel subdirs project.
-
Hi and welcome to devnet,
I don't see anything fundamentally wrong with what you posted.
What I would do, is start smaller and go up step by step.
Start with just building the Object project. Then once it builds, go up one level and repeat until your reached Project. That way you first ensure that Object correctly builds without all the structure of a multilevel subdirs project.
@SGaist Somehow, when I moved the entire projects into Documents it suddenly found all of the files for some reason. Which I do not really understand, because I created this project in the Projects folder which is in my Documents. Is there a reason for this?
-
Well... Currently except gremlins I don't see any specific reasons.
Can you provided a minimal buildable project that reproduces that ?