[Solved] QtTest project Linker errors on VS2010
-
[quote author="Link0" date="1337076512"]
That said, which steps do you mean by step by step. [/quote]Removing the duality of constructors and seeing what the next issue is.
If you the same (should be a different now, because you changed classes) linking error, it has something to do with the linking process. Use a small example and pack everything into one source and one header file. This should work. After this separate the files. This may help to localize your problem.
-
[quote author="Link0" date="1337068365"]
Write the original project, including Gate.cpp and Gate.h
Add a new test project to the original project's solution.
Added the QtTest module to the test project.
Add the original project's main folder as a dependency
Write the toUpper() test and successfully build.
Write TypeTest(), and get the linker errors.
[/quote]
Seems you did something basicly wrong.
As I said before, if your original project is library, you should link the library to your test project. if not, you should add the source files to your test project.
"dependency" don't help you to solve the problem. They are still two dependent projects, the only side effect is that when you build your test project, original project will be build first.
Debao
-
Right you are! Had to add the folder under additional include directories. Apparently no one ever did. Thank you for both of your time.
(they really need to make VS more straightforward)
EDIT: wait. dang. i had the relevant code commented in this version. problem persists.
-
Some testing later.
Putting all code into a header file and then including that worked, as soon as i pull the relevant code back into a cpp file, the linker errors return.
As for the other idea, It's not a library, so i can't link to it statically.
Attempting to add the .cpp file to the project did not work either, surprisingly, and i'm not entirely sure if i should do that in any case, considering the code changes and such. -
[quote author="Link0" date="1337068365"]
These are the exact steps i've performed in VS2010 to get here:Write the original project, including Gate.cpp and Gate.h
Add a new test project to the original project's solution.
Added the QtTest module to the test project.
Add the original project's main folder as a dependency
Write the toUpper() test and successfully build.
Write TypeTest(), and get the linker errors.
[/quote]
What do you actually mean with:
Add the original project's main folder as a dependency
??
Are you adding the files of your original project as "existing items" ?
-
The project dependency is for projects with libs. You got 3 projects lib1, lib2 and a main. You change main, it will compile main and link the lib1 and lib2 to main to get exe. You change lib2, lib2 will be compiled and linked with lib1 and main to exe. And whatever mutations.
However, you have libs and the outcome, the libs, has to be linked to your project. To my understanding you have no libs, but you got two exe in two projects. For this it does not work. You need to add the source and header files as "existing items" to your test applications. They will be compiled again and linked to your test application.
Otherwise you can create a lib project and two application projects. However, you need to link to both application projects the lib. Otherwise it will not work.