qt-creatorqmake

Qt build path issue and file not found


There are two projects, FFObject and DDS, corresponding to two. pro files. After the DDS project is built, a libDDS. a file will be generated, which is required for the FFObject project during construction. But no matter how I modify the build path, I always get an error saying that I can't find the libDDS. a file when building FFObjects. The following is the code for finding files in the FFObject. pro file, the path for building DDS, and error messages. May I ask how to handle this situation. DDS Build Path:enter image description here The code in the FFObject. pro file:enter image description here Error message:enter image description here

These two projects are not in the same project file, they are separate projects

I tried to modify the build directory many times, but none of them had any effect.


Solution

  • In your .pro file you have win32: ... LIBS += -L$$OUT_PWD/../DDS/release -lDDS. But in your first image it shows the build path to be in a folder named "build-FFObject-Desktop...". So, I suspect the path added to LIBS is not valid.

    Here is what I would suggest you to try:

    1. Disable "Shadow build" in your Qt Creator Project mode build settings for both projects to get more predictable build paths:

    enter image description here

    Maybe after unchecking the Shadow build the directory structure would be more in line what you expect it to be. The shadow build option is what creates that separate "build-FFObject-Desktop..." build directory. Without it the library will be built next to the source code.

    1. If it still does not work, add a message command to your .pro file to actually print out where does it look for the files and then make sure the file exists there. Something like message("-L$$OUT_PWD/../DDS/release/libDDS.a"). After adding the message, run qmake and check the "Compile Output" pane to see the printout of a path where the .a file is supposed to be.