How to run Unit Test and main project ?
-
I want to run Unit test for my Qt project and i got an error with the definition of the main and it indicates that one or more multiply defined symbols found :
main.obj:-1: error: LNK2005: main already defined in test_api.obj
debug\Pixii_App_1.exe:-1: error: LNK1169: one or more multiply defined symbols found
Here you found the .pro file : -
You have to create two separate executables
-
@Christian-Ehrlicher How to create them?
-
Add a second add_executable() to your CMakeLists.txt.
-
@Christian-Ehrlicher I'm using qmake i had .pro file
-
Then create a subdirecory for your test and create a new pro file in there.
-
Hi,
The best way to do it is to create a subdirs project as described here. Even though it shows it for an application with libraries, the same concept applies to adding tests. You can check the Qt 5 sources, they are using that concept there.
-