[SOLVED] subfolder .obj not generated when using CONFIG += object_parallel_to_source with nmake



  • Hello,

    So my original problem is that I have one project where multiple files from different folders have the same name. I cannot change the names because those folders are part of a library that was previously compiled with visual studio that I am trying to transfer to Qt creator (with a qmake based compilation).
    I saw that when CONFIG += object_parallel_to_source is used the .obj are suposed to be placed in a replica of my project structure which solve the problem of the files with identical names.
    During the compilation i had linking error message telling me that some .obj files couldn't be found.

    So I tried it with a simpler project:
    project_folder:
    ->main.cpp
    ->subfolder:
    ->->func.h
    ->->func.cpp

    with the func.h & .cpp defining a simple "hello world" function that is called in the main

    The .pro file contains the following lines:

    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt
    SOURCES += main.cpp \
            subfolder\func.cpp
    HEADERS += subfolder\func.h
    CONFIG += object_parallel_to_source
    

    When executing Qmake it indeed create all the new folder for the compilation.
    But when compiling I get a linking error indicating that the file func.obj can't be found:
    LNK1104: cannot open file 'debug\subfolder\func.obj'

    And indeed the files doesn't exist. And when checking the copilation steps the func.cpp file is not compiled ...

    Is there anything I did wrong to use the object_parallel_to_source option?

    Ah and I precise, I'm not compiling with a shadow build (but I tryed it also and it doesn't works anyway)



  • Ok found the reason.
    The option CONFIG += object_parallel_to_source is currently bugged. Even if it create all the repertories to replicate the project folder it won't compile the .obj in them.

    Qmake produce compilation rules like this:

    {subfolder}.cpp{debug\}.obj::
    	$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\ @<<
    	$<
    <<
    

    but the one it should generate is

    {subfolder}.cpp{debug\subfolder}.obj::
    	$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fodebug\subfolder @<<
    	$<
    <<
    

    EDIT: To get it to work you have to add CONFIG += no_batch even if there are no filename conflicts. Why it's not automaticaly done when you use the CONFIG += object_parallel_to_source will stay a mystery ...


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Good question, it might be a bug. You should check the bug report system for object_parallel_to_source to see if you find something about it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.