Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Cannot Open Source File no such file or directory
Forum Updated to NodeBB v4.3 + New Features

Cannot Open Source File no such file or directory

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sailanarmo
    wrote on 15 Apr 2019, 16:41 last edited by
    #1

    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, and Project.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, and Base and External 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 to base.pro other than it has the subdirs of Base and External. 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 the Base Folder and External 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"
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 15 Apr 2019, 20:06 last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 17 Apr 2019, 16:02
      1
      • S SGaist
        15 Apr 2019, 20:06

        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.

        S Offline
        S Offline
        Sailanarmo
        wrote on 17 Apr 2019, 16:02 last edited by
        #3

        @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?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 17 Apr 2019, 20:33 last edited by
          #4

          Well... Currently except gremlins I don't see any specific reasons.

          Can you provided a minimal buildable project that reproduces that ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          1/4

          15 Apr 2019, 16:41

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved