qmake source



  • when I try to build a project, I get a warning
    :-1: warning: C:/RealsenseRecorder/source/main.cpp conflicts with C:/gtestExample/main.cpp
    but when i print SOURCES variable i get

    C:/googletest/googletest/src/gtest-all.cc C:/googletest/googlemock/src/gmock-all.cc C:/gtestExample/main.cpp C:\RealsenseRecorder\source\audiorecorder.cpp C:\RealsenseRecorder\source\mainwindow.cpp C:\RealsenseRecorder\source\videorecorder.cpp

    as you can see, there is no
    C:/RealsenseRecorder/source/main.cpp


  • Qt Champions 2017

    Hi
    Check the pro file if its listed.
    Also check its not using SOURCE += *.cpp or something like that.
    Also delete the actual build folder.
    Then rebuild all.

    Oh just saw.
    Did you use
    SOURCES += $$PWD$$/source/*.cpp
    for this project ?

    Also , does the file actually exists where it says?



  • no, in this project I did not write like that to exclude the main.cpp. Yes, such a file does exist

    HEADERS += tst_1.h
    HEADERS += C:\RealsenseRecorder\include\mainwindow.h
    HEADERS += C:\RealsenseRecorder\ui_mainwindow.h
    SOURCES += $$PWD$$/main.cpp

    INCLUDEPATH += C:\RealsenseRecorder
    INCLUDEPATH += C:\RealsenseRecorder\include
    INCLUDEPATH += "$(RSSDK_DIR)/include"
    INCLUDEPATH += "$(OPENCV3_DIR)/include"

    SOURCES += C:\RealsenseRecorder\source\audiorecorder.cpp
    SOURCES += C:\RealsenseRecorder\source\mainwindow.cpp
    SOURCES += C:\RealsenseRecorder\source\videorecorder.cpp

    SOURCES -= C:\RealsenseRecorder\source\main.cpp
    message($$SOURCES)

    pwd is equal C:\gtestExample


  • Qt Champions 2017

    Hi
    If its not listed in .pro and you do not
    auto add with *.cpp
    It seems pretty impossible.



  • Hi @danyal,

    First, I'd print SOURCES in lots of places, but especially before and after your $$PWD line (and note that the second $$ does nothing) eg:

    messages(A: $$SOURCES)
    SOURCES += $$PWD/main.cpp
    messages(B: $$SOURCES)
    

    Next try running: qmake -r -Wall -Wlogic -Wparser and show us the output.

    Then, if there's nothing obvious there, add up to three -d arguments as well.

    With -d things can get pretty noisy, so personally, I'd do something like:

    qmake -d -d -d -d -r -Wall -Wlogic -Wparser 2>&1 | grep 'RealsenseRecorder.*main\.cpp'
    

    to try to narrow down the problem quicker (not sure of the equivalent syntax on Windows, or if that syntax is valid on Windows). Typically I'd follow that up by replacing the grep with less and search through to each instance of main.cpp, but you might prefer to output to a file and look through it with a text editor or something. Whatever works for you.

    Another thing to check is: do you have any include statements anywhere in your project's QMake files? (this would probably be revealed by the qmake -r output above too).

    Cheers.


Log in to reply
 

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