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
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
pwd is equal C:\gtestExample
If its not listed in .pro and you do not
auto add with *.cpp
It seems pretty impossible.
First, I'd print
SOURCESin lots of places, but especially before and after your
$$PWDline (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 -Wparserand show us the output.
Then, if there's nothing obvious there, add up to three
-darguments as well.
-dthings 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
lessand 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
includestatements anywhere in your project's QMake files? (this would probably be revealed by the
qmake -routput above too).