Skip to main content
GameDev.net gamedev.net
🔒 Locked

Linking Problem

Started by sled Aug 28, 2006 at 9:07 PM 1 replies 1.7k views
Original Post
sled
sled
I'm trying to use UnitTest++ with a test project and getting six LNK2019 errors. I am using Visual Studio 2005. I added the UnitTest++ src folder to my list of include directories. What else do I need to do to get it running? Here is my simple code:

#include "stdafx.h"
#include <UnitTest++.h>


TEST(FailSpectacularly){ 
	CHECK(false);
}

int _tmain(int argc, _TCHAR* argv[])
{
	return UnitTest::RunAllTests();
}



and here are the errors: ------ Rebuild All started: Project: Vector Test, Configuration: Debug Win32 ------ Deleting intermediate and output files for project 'Vector Test', configuration 'Debug|Win32' Compiling... stdafx.cpp Compiling... Vector Test.cpp Vector.cpp Generating Code... Compiling manifest to resources... Linking... Vector Test.obj : error LNK2019: unresolved external symbol "public: void __thiscall UnitTest::TestResults::OnTestFailure(char const *,int,char const *,char const *)" (?OnTestFailure@TestResults@UnitTest@@QAEXPBDH00@Z) referenced in function "private: virtual void __thiscall TestFailSpectacularly::RunImpl(class UnitTest::TestResults &)const " (?RunImpl@TestFailSpectacularly@@EBEXAAVTestResults@UnitTest@@@Z) Vector Test.obj : error LNK2019: unresolved external symbol "int __cdecl UnitTest::RunAllTests(void)" (?RunAllTests@UnitTest@@YAHXZ) referenced in function _wmain Vector Test.obj : error LNK2019: unresolved external symbol "public: __thiscall UnitTest::Test::Test(char const *,char const *,int)" (??0Test@UnitTest@@QAE@PBD0H@Z) referenced in function "public: __thiscall TestFailSpectacularly::TestFailSpectacularly(void)" (??0TestFailSpectacularly@@QAE@XZ) Vector Test.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall UnitTest::Test::~Test(void)" (??1Test@UnitTest@@UAE@XZ) referenced in function "public: virtual __thiscall TestFailSpectacularly::~TestFailSpectacularly(void)" (??1TestFailSpectacularly@@UAE@XZ) Vector Test.obj : error LNK2019: unresolved external symbol "public: __thiscall UnitTest::ListAdder::ListAdder(class UnitTest::TestList &,class UnitTest::Test *)" (??0ListAdder@UnitTest@@QAE@AAVTestList@1@PAVTest@1@@Z) referenced in function "void __cdecl dynamic initializer for 'adderFailSpectacularly''(void)" (??__EadderFailSpectacularly@@YAXXZ) Vector Test.obj : error LNK2019: unresolved external symbol "public: static class UnitTest::TestList & __cdecl UnitTest::Test::GetTestList(void)" (?GetTestList@Test@UnitTest@@SAAAVTestList@2@XZ) referenced in function "void __cdecl dynamic initializer for 'adderFailSpectacularly''(void)" (??__EadderFailSpectacularly@@YAXXZ) C:\Documents and Settings\Eddie\My Documents\Visual Studio 2005\Projects\Vector Test\Debug\Vector Test.exe : fatal error LNK1120: 6 unresolved externals Build log was saved at "file://c:\Documents and Settings\Eddie\My Documents\Visual Studio 2005\Projects\Vector Test\Vector Test\Debug\BuildLog.htm" Vector Test - 7 error(s), 0 warning(s) ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Fruny
Fruny
Odds are that there is a library you need to link to, or source files you need to add to your project - but didn't.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Heewa
Heewa
Check out the sample solution that's included. Try to duplicate Project options. Pay special ettention to the Linker section. I'm guessing there's a library you're not linking to. You usually don't need to include something like this into your solution to use it. That's what libraries are for!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.