Hi, there are multiple options but here is the common approach:
If you are building a library; don't bother just link your test executable to that library as any other would do. If you are building an executable, put all your code except main() into a static library and link that into the test executable and link your executable to that library. You need not make any changes to the sources, just your build. Sean On Sat, Apr 17, 2010 at 11:49 PM, lukas plachta <lukas.plac...@centrum.cz> wrote: > > Hi, Im new to UnitTest++, > I have a question about including tested objects... > > I have cpp project - for example application contactBook, there is a object > Contact, in files contact.h, contact.cpp... > And another cpp test project contactBookTests, there is main.cpp with > runAll() and contact_test.cpp with some test for Contact class... > > Inside contact_test.cpp, there is include "../src/contact.h"... > The test project need also the implementation of the Contact, to test it... > 1/ I can include also "../src/contact.cpp" - ugly sollution > 2/ or add the contact.cpp as compiler argument (when compiling test) > These sollutions work fine. > > Both sollutions are ugly I think. I compile tested class inside test project. > I hope it would be better to compile contactBook project once... so there is > contact.o object binary file... > And compile test project once... with some including contact.o as a library > or something like that.... > > Then, when I make changes in Contact class, I can recompile contact project - > to get new contact.o > And simpy run the compiled test project (without recompilation)... > > I hope, this is better way, but I dont know, how to make it work like that. > Is it possible ? > > Im using CodeLite IDE, when I add contact.o as a library, with parameter > -lcontact.o, linker is not able to find it... > Thanks for any advice or link to some explanation, how to link tests, I didnt > find anything > Best regards, > LP > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > unittest-cpp-devel mailing list > unittest-cpp-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/unittest-cpp-devel > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ unittest-cpp-devel mailing list unittest-cpp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/unittest-cpp-devel