<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Was will mir der Compiler sagen]]></title><description><![CDATA[<p>Ich habe gerade das Google C++ Testing framework auf meinem Mac installiert und erfolgreich getestet. Jetzt wollte ich das Beispiel auf einer Linux Maschine (da hab ich keine Root-Rechte) installieren und ebenfalls testen.</p>
<p>Hier der Beispiel Code<br />
MyClass.h</p>
<pre><code class="language-cpp">#ifndef MYCLASS_H_
#define MYCLASS_H_

class MyClass {

	public:
	int method1( int a, int b );

};

#endif /* MYCLASS_H_ */
</code></pre>
<p>MyClass.cpp</p>
<pre><code class="language-cpp">#include &quot;MyClass.h&quot;

int MyClass::method1( int a, int b )
{
	return 7;
}
</code></pre>
<p>MyClassTest.cpp</p>
<pre><code class="language-cpp">#include &quot;MyClass.h&quot;
#include &quot;gtest/gtest.h&quot;

namespace {

// The fixture for testing class Foo.
class MyClassTest : public ::testing::Test {
protected:
	// You can remove any or all of the following functions if its body
	// is empty.

	MyClassTest() {
		// You can do set-up work for each test here.
	}

	virtual ~MyClassTest() {
		// You can do clean-up work that doesn't throw exceptions here.
	}

	// If the constructor and destructor are not enough for setting up
	// and cleaning up each test, you can define the following methods:

	virtual void SetUp() {
		// Code here will be called immediately after the constructor (right
		// before each test).
	}

	virtual void TearDown() {
		// Code here will be called immediately after each test (right
		// before the destructor).
	}

	// Objects declared here can be used by all tests in the test case for Foo.
};

TEST_F(MyClassTest, MethodBarDoesAbc) {
	MyClass myClass;
	EXPECT_EQ( 7, myClass.method1(1,1) );
}

}  // namespace

int main(int argc, char **argv) {
	::testing::InitGoogleTest(&amp;argc, argv);
	return RUN_ALL_TESTS();
}
</code></pre>
<p>So sieht mein Makefile aus:</p>
<blockquote>
<p>CXX = g++<br />
CFLAGS =</p>
<p>GTEST_INCLUDE = /pfad/zu/gtest-1.6.0/include<br />
GTEST_LIBS = /pfad/zu/gtest-1.6.0</p>
<p>LIBS = -L<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>(</mo><mi>G</mi><mi>T</mi><mi>E</mi><mi>S</mi><msub><mi>T</mi><mi>L</mi></msub><mi>I</mi><mi>B</mi><mi>S</mi><mo>)</mo><mo>−</mo><mi>l</mi><mi>g</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi><mi>I</mi><mi>N</mi><mi>C</mi><mi>L</mi><mi>U</mi><mi>D</mi><mi>E</mi><mo>=</mo><mo>−</mo><mi>I</mi></mrow><annotation encoding="application/x-tex">(GTEST_LIBS) -lgtest  
INCLUDE = -I</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mopen">(</span><span class="mord mathit">G</span><span class="mord mathit" style="margin-right:0.13889em;">T</span><span class="mord mathit" style="margin-right:0.05764em;">E</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mord"><span class="mord mathit" style="margin-right:0.13889em;">T</span><span class="vlist"><span style="top:0.15em;margin-right:0.05em;margin-left:-0.13889em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord mathit">L</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="mord mathit" style="margin-right:0.07847em;">I</span><span class="mord mathit" style="margin-right:0.05017em;">B</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mclose">)</span><span class="mbin">−</span><span class="mord mathit" style="margin-right:0.01968em;">l</span><span class="mord mathit" style="margin-right:0.03588em;">g</span><span class="mord mathit">t</span><span class="mord mathit">e</span><span class="mord mathit">s</span><span class="mord mathit">t</span><span class="mord mathit" style="margin-right:0.07847em;">I</span><span class="mord mathit" style="margin-right:0.10903em;">N</span><span class="mord mathit" style="margin-right:0.07153em;">C</span><span class="mord mathit">L</span><span class="mord mathit" style="margin-right:0.10903em;">U</span><span class="mord mathit" style="margin-right:0.02778em;">D</span><span class="mord mathit" style="margin-right:0.05764em;">E</span><span class="mrel">=</span><span class="mord">−</span><span class="mord mathit" style="margin-right:0.07847em;">I</span></span></span></span>(GTEST_INCLUDE)</p>
<p>TARGET = MyClassTest<br />
OBJFILES = MyClass.o MyClassTest.o<br />
FILES = MyClass.cpp MyClassTest.cpp</p>
<p>$(TARGET): <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>(</mo><mi>O</mi><mi>B</mi><mi>J</mi><mi>F</mi><mi>I</mi><mi>L</mi><mi>E</mi><mi>S</mi><mo>)</mo></mrow><annotation encoding="application/x-tex">(OBJFILES)  
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mopen">(</span><span class="mord mathit" style="margin-right:0.02778em;">O</span><span class="mord mathit" style="margin-right:0.05017em;">B</span><span class="mord mathit" style="margin-right:0.09618em;">J</span><span class="mord mathit" style="margin-right:0.13889em;">F</span><span class="mord mathit" style="margin-right:0.07847em;">I</span><span class="mord mathit">L</span><span class="mord mathit" style="margin-right:0.05764em;">E</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mclose">)</span></span></span></span>(CXX) $(LIBS) -o $(TARGET) $^<br />
rm *.o</p>
<p>$(OBJFILES): <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>(</mo><mi>F</mi><mi>I</mi><mi>L</mi><mi>E</mi><mi>S</mi><mo>)</mo></mrow><annotation encoding="application/x-tex">(FILES)  
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mopen">(</span><span class="mord mathit" style="margin-right:0.13889em;">F</span><span class="mord mathit" style="margin-right:0.07847em;">I</span><span class="mord mathit">L</span><span class="mord mathit" style="margin-right:0.05764em;">E</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mclose">)</span></span></span></span>(CXX) $(CFLAGS) $(INCLUDE) -c $^</p>
<p>all:$(TARGET)</p>
<p>clean:<br />
rm *.o $(TARGET)</p>
</blockquote>
<p>Die Pfade im Makefile sind korrekt gesetzt und auch die Bibliothek konnte ich korrekt übersetzen und es läuft auf meinem Mac einwandfrei. Auf der Linux-Maschine erhalte ich aber folgende Fehlerausgabe:</p>
<blockquote>
<p>/C++/GTestDemo&gt; make<br />
g++ -I/pfad/zu/gtest-1.6.0/include -c MyClass.cpp MyClassTest.cpp<br />
g++ -L/pfad/zu/gtest-1.6.0 -lgtest -o MyClassTest MyClass.o MyClassTest.o<br />
MyClassTest.o: In function <code>(anonymous namespace)::MyClassTest::MyClassTest()': MyClassTest.cpp:(.text+0x14): undefined reference to</code>testing::Test::Test()'<br />
MyClassTest.o: In function <code>(anonymous namespace)::MyClassTest::~MyClassTest()': MyClassTest.cpp:(.text+0x45): undefined reference to</code>testing::Test::~Test()'<br />
MyClassTest.o: In function <code>(anonymous namespace)::MyClassTest\_MethodBarDoesAbc\_Test::TestBody()': MyClassTest.cpp:(.text+0x180): undefined reference to</code>testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'<br />
MyClassTest.cpp:(.text+0x193): undefined reference to <code>testing::internal::AssertHelper::operator=(testing::Message const&amp;) const' MyClassTest.cpp:(.text+0x19f): undefined reference to</code>testing::internal::AssertHelper::~AssertHelper()'<br />
MyClassTest.cpp:(.text+0x1d5): undefined reference to <code>testing::internal::AssertHelper::~AssertHelper()' MyClassTest.o: In function</code>main':<br />
MyClassTest.cpp:(.text+0x224): undefined reference to <code>testing::InitGoogleTest(int*, char**)' MyClassTest.cpp:(.text+0x229): undefined reference to</code>testing::UnitTest::GetInstance()'<br />
MyClassTest.cpp:(.text+0x231): undefined reference to <code>testing::UnitTest::Run()' MyClassTest.o: In function</code>__static_initialization_and_destruction_0(int, int)':<br />
MyClassTest.cpp:(.text+0x39b): undefined reference to <code>testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)' MyClassTest.o:(.rodata+0x170): undefined reference to</code>typeinfo for testing::Test'<br />
MyClassTest.o: In function <code>testing::internal::scoped\_ptr&lt;std::basic\_string&lt;char, std::char\_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::reset(std::basic\_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;*)': MyClassTest.cpp:(.text.\_ZN7testing8internal10scoped\_ptrISsE5resetEPSs\[testing::internal::scoped\_ptr&lt;std::basic\_string&lt;char, std::char\_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::reset(std::basic\_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;*)\]+0x24): undefined reference to</code>testing::internal::IsTrue(bool)'<br />
MyClassTest.o: In function <code>testing::internal::scoped\_ptr&lt;std::basic\_stringstream&lt;char, std::char\_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::reset(std::basic\_stringstream&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;*)': MyClassTest.cpp:(.text.\_ZN7testing8internal10scoped\_ptrISt18basic\_stringstreamIcSt11char\_traitsIcESaIcEEE5resetEPS6_\[testing::internal::scoped\_ptr&lt;std::basic\_stringstream&lt;char, std::char\_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::reset(std::basic\_stringstream&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;*)\]+0x23): undefined reference to</code>testing::internal::IsTrue(bool)'<br />
MyClassTest.o: In function <code>testing::AssertionResult testing::internal::CmpHelperEQ&lt;int, int&gt;(char const*, char const*, int const&amp;, int const&amp;)': MyClassTest.cpp:(.text.\_ZN7testing8internal11CmpHelperEQIiiEENS\_15AssertionResultEPKcS4\_RKT\_RKT0_\[testing::AssertionResult testing::internal::CmpHelperEQ&lt;int, int&gt;(char const*, char const*, int const&amp;, int const&amp;)\]+0x35): undefined reference to</code>testing::AssertionSuccess()'<br />
MyClassTest.cpp:(.text._ZN7testing8internal11CmpHelperEQIiiEENS_15AssertionResultEPKcS4_RKT_RKT0_[testing::AssertionResult testing::internal::CmpHelperEQ&lt;int, int&gt;(char const*, char const*, int const&amp;, int const&amp;)]+0x8f): undefined reference to `testing::internal::EqFailure(char const*, char const*, testing::internal::String const&amp;, testing::internal::String const&amp;, bool)'<br />
collect2: ld returned 1 exit status<br />
make: *** [MyClassTest] Error 1</p>
</blockquote>
<p>Was funktioniert hier denn nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/294850/was-will-mir-der-compiler-sagen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 17:20:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/294850.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 02 Nov 2011 14:36:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Was will mir der Compiler sagen on Wed, 02 Nov 2011 14:36:11 GMT]]></title><description><![CDATA[<p>Ich habe gerade das Google C++ Testing framework auf meinem Mac installiert und erfolgreich getestet. Jetzt wollte ich das Beispiel auf einer Linux Maschine (da hab ich keine Root-Rechte) installieren und ebenfalls testen.</p>
<p>Hier der Beispiel Code<br />
MyClass.h</p>
<pre><code class="language-cpp">#ifndef MYCLASS_H_
#define MYCLASS_H_

class MyClass {

	public:
	int method1( int a, int b );

};

#endif /* MYCLASS_H_ */
</code></pre>
<p>MyClass.cpp</p>
<pre><code class="language-cpp">#include &quot;MyClass.h&quot;

int MyClass::method1( int a, int b )
{
	return 7;
}
</code></pre>
<p>MyClassTest.cpp</p>
<pre><code class="language-cpp">#include &quot;MyClass.h&quot;
#include &quot;gtest/gtest.h&quot;

namespace {

// The fixture for testing class Foo.
class MyClassTest : public ::testing::Test {
protected:
	// You can remove any or all of the following functions if its body
	// is empty.

	MyClassTest() {
		// You can do set-up work for each test here.
	}

	virtual ~MyClassTest() {
		// You can do clean-up work that doesn't throw exceptions here.
	}

	// If the constructor and destructor are not enough for setting up
	// and cleaning up each test, you can define the following methods:

	virtual void SetUp() {
		// Code here will be called immediately after the constructor (right
		// before each test).
	}

	virtual void TearDown() {
		// Code here will be called immediately after each test (right
		// before the destructor).
	}

	// Objects declared here can be used by all tests in the test case for Foo.
};

TEST_F(MyClassTest, MethodBarDoesAbc) {
	MyClass myClass;
	EXPECT_EQ( 7, myClass.method1(1,1) );
}

}  // namespace

int main(int argc, char **argv) {
	::testing::InitGoogleTest(&amp;argc, argv);
	return RUN_ALL_TESTS();
}
</code></pre>
<p>So sieht mein Makefile aus:</p>
<blockquote>
<p>CXX = g++<br />
CFLAGS =</p>
<p>GTEST_INCLUDE = /pfad/zu/gtest-1.6.0/include<br />
GTEST_LIBS = /pfad/zu/gtest-1.6.0</p>
<p>LIBS = -L<span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>(</mo><mi>G</mi><mi>T</mi><mi>E</mi><mi>S</mi><msub><mi>T</mi><mi>L</mi></msub><mi>I</mi><mi>B</mi><mi>S</mi><mo>)</mo><mo>−</mo><mi>l</mi><mi>g</mi><mi>t</mi><mi>e</mi><mi>s</mi><mi>t</mi><mi>I</mi><mi>N</mi><mi>C</mi><mi>L</mi><mi>U</mi><mi>D</mi><mi>E</mi><mo>=</mo><mo>−</mo><mi>I</mi></mrow><annotation encoding="application/x-tex">(GTEST_LIBS) -lgtest  
INCLUDE = -I</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mopen">(</span><span class="mord mathit">G</span><span class="mord mathit" style="margin-right:0.13889em;">T</span><span class="mord mathit" style="margin-right:0.05764em;">E</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mord"><span class="mord mathit" style="margin-right:0.13889em;">T</span><span class="vlist"><span style="top:0.15em;margin-right:0.05em;margin-left:-0.13889em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord mathit">L</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="mord mathit" style="margin-right:0.07847em;">I</span><span class="mord mathit" style="margin-right:0.05017em;">B</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mclose">)</span><span class="mbin">−</span><span class="mord mathit" style="margin-right:0.01968em;">l</span><span class="mord mathit" style="margin-right:0.03588em;">g</span><span class="mord mathit">t</span><span class="mord mathit">e</span><span class="mord mathit">s</span><span class="mord mathit">t</span><span class="mord mathit" style="margin-right:0.07847em;">I</span><span class="mord mathit" style="margin-right:0.10903em;">N</span><span class="mord mathit" style="margin-right:0.07153em;">C</span><span class="mord mathit">L</span><span class="mord mathit" style="margin-right:0.10903em;">U</span><span class="mord mathit" style="margin-right:0.02778em;">D</span><span class="mord mathit" style="margin-right:0.05764em;">E</span><span class="mrel">=</span><span class="mord">−</span><span class="mord mathit" style="margin-right:0.07847em;">I</span></span></span></span>(GTEST_INCLUDE)</p>
<p>TARGET = MyClassTest<br />
OBJFILES = MyClass.o MyClassTest.o<br />
FILES = MyClass.cpp MyClassTest.cpp</p>
<p>$(TARGET): <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>(</mo><mi>O</mi><mi>B</mi><mi>J</mi><mi>F</mi><mi>I</mi><mi>L</mi><mi>E</mi><mi>S</mi><mo>)</mo></mrow><annotation encoding="application/x-tex">(OBJFILES)  
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mopen">(</span><span class="mord mathit" style="margin-right:0.02778em;">O</span><span class="mord mathit" style="margin-right:0.05017em;">B</span><span class="mord mathit" style="margin-right:0.09618em;">J</span><span class="mord mathit" style="margin-right:0.13889em;">F</span><span class="mord mathit" style="margin-right:0.07847em;">I</span><span class="mord mathit">L</span><span class="mord mathit" style="margin-right:0.05764em;">E</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mclose">)</span></span></span></span>(CXX) $(LIBS) -o $(TARGET) $^<br />
rm *.o</p>
<p>$(OBJFILES): <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mo>(</mo><mi>F</mi><mi>I</mi><mi>L</mi><mi>E</mi><mi>S</mi><mo>)</mo></mrow><annotation encoding="application/x-tex">(FILES)  
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mopen">(</span><span class="mord mathit" style="margin-right:0.13889em;">F</span><span class="mord mathit" style="margin-right:0.07847em;">I</span><span class="mord mathit">L</span><span class="mord mathit" style="margin-right:0.05764em;">E</span><span class="mord mathit" style="margin-right:0.05764em;">S</span><span class="mclose">)</span></span></span></span>(CXX) $(CFLAGS) $(INCLUDE) -c $^</p>
<p>all:$(TARGET)</p>
<p>clean:<br />
rm *.o $(TARGET)</p>
</blockquote>
<p>Die Pfade im Makefile sind korrekt gesetzt und auch die Bibliothek konnte ich korrekt übersetzen und es läuft auf meinem Mac einwandfrei. Auf der Linux-Maschine erhalte ich aber folgende Fehlerausgabe:</p>
<blockquote>
<p>/C++/GTestDemo&gt; make<br />
g++ -I/pfad/zu/gtest-1.6.0/include -c MyClass.cpp MyClassTest.cpp<br />
g++ -L/pfad/zu/gtest-1.6.0 -lgtest -o MyClassTest MyClass.o MyClassTest.o<br />
MyClassTest.o: In function <code>(anonymous namespace)::MyClassTest::MyClassTest()': MyClassTest.cpp:(.text+0x14): undefined reference to</code>testing::Test::Test()'<br />
MyClassTest.o: In function <code>(anonymous namespace)::MyClassTest::~MyClassTest()': MyClassTest.cpp:(.text+0x45): undefined reference to</code>testing::Test::~Test()'<br />
MyClassTest.o: In function <code>(anonymous namespace)::MyClassTest\_MethodBarDoesAbc\_Test::TestBody()': MyClassTest.cpp:(.text+0x180): undefined reference to</code>testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'<br />
MyClassTest.cpp:(.text+0x193): undefined reference to <code>testing::internal::AssertHelper::operator=(testing::Message const&amp;) const' MyClassTest.cpp:(.text+0x19f): undefined reference to</code>testing::internal::AssertHelper::~AssertHelper()'<br />
MyClassTest.cpp:(.text+0x1d5): undefined reference to <code>testing::internal::AssertHelper::~AssertHelper()' MyClassTest.o: In function</code>main':<br />
MyClassTest.cpp:(.text+0x224): undefined reference to <code>testing::InitGoogleTest(int*, char**)' MyClassTest.cpp:(.text+0x229): undefined reference to</code>testing::UnitTest::GetInstance()'<br />
MyClassTest.cpp:(.text+0x231): undefined reference to <code>testing::UnitTest::Run()' MyClassTest.o: In function</code>__static_initialization_and_destruction_0(int, int)':<br />
MyClassTest.cpp:(.text+0x39b): undefined reference to <code>testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)' MyClassTest.o:(.rodata+0x170): undefined reference to</code>typeinfo for testing::Test'<br />
MyClassTest.o: In function <code>testing::internal::scoped\_ptr&lt;std::basic\_string&lt;char, std::char\_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::reset(std::basic\_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;*)': MyClassTest.cpp:(.text.\_ZN7testing8internal10scoped\_ptrISsE5resetEPSs\[testing::internal::scoped\_ptr&lt;std::basic\_string&lt;char, std::char\_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::reset(std::basic\_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;*)\]+0x24): undefined reference to</code>testing::internal::IsTrue(bool)'<br />
MyClassTest.o: In function <code>testing::internal::scoped\_ptr&lt;std::basic\_stringstream&lt;char, std::char\_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::reset(std::basic\_stringstream&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;*)': MyClassTest.cpp:(.text.\_ZN7testing8internal10scoped\_ptrISt18basic\_stringstreamIcSt11char\_traitsIcESaIcEEE5resetEPS6_\[testing::internal::scoped\_ptr&lt;std::basic\_stringstream&lt;char, std::char\_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;::reset(std::basic\_stringstream&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;*)\]+0x23): undefined reference to</code>testing::internal::IsTrue(bool)'<br />
MyClassTest.o: In function <code>testing::AssertionResult testing::internal::CmpHelperEQ&lt;int, int&gt;(char const*, char const*, int const&amp;, int const&amp;)': MyClassTest.cpp:(.text.\_ZN7testing8internal11CmpHelperEQIiiEENS\_15AssertionResultEPKcS4\_RKT\_RKT0_\[testing::AssertionResult testing::internal::CmpHelperEQ&lt;int, int&gt;(char const*, char const*, int const&amp;, int const&amp;)\]+0x35): undefined reference to</code>testing::AssertionSuccess()'<br />
MyClassTest.cpp:(.text._ZN7testing8internal11CmpHelperEQIiiEENS_15AssertionResultEPKcS4_RKT_RKT0_[testing::AssertionResult testing::internal::CmpHelperEQ&lt;int, int&gt;(char const*, char const*, int const&amp;, int const&amp;)]+0x8f): undefined reference to `testing::internal::EqFailure(char const*, char const*, testing::internal::String const&amp;, testing::internal::String const&amp;, bool)'<br />
collect2: ld returned 1 exit status<br />
make: *** [MyClassTest] Error 1</p>
</blockquote>
<p>Was funktioniert hier denn nicht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139376</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139376</guid><dc:creator><![CDATA[XYZ2011]]></dc:creator><pubDate>Wed, 02 Nov 2011 14:36:11 GMT</pubDate></item><item><title><![CDATA[Reply to Was will mir der Compiler sagen on Wed, 02 Nov 2011 14:39:25 GMT]]></title><description><![CDATA[<p>Du hast vergessen, irgend eine Lib zu linken.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139381</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139381</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Wed, 02 Nov 2011 14:39:25 GMT</pubDate></item><item><title><![CDATA[Reply to Was will mir der Compiler sagen on Wed, 02 Nov 2011 14:39:58 GMT]]></title><description><![CDATA[<p>Setz das -lgtest ganz an's Ende. Die Reihenfolge spielt beim gcc eine Rolle.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139382</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139382</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 02 Nov 2011 14:39:58 GMT</pubDate></item><item><title><![CDATA[Reply to Was will mir der Compiler sagen on Wed, 02 Nov 2011 14:45:50 GMT]]></title><description><![CDATA[<p>Ich hab jetzt mal lgtest ganz ans Ende gesetzt, d.h.</p>
<blockquote>
<p>$(CXX) -o $(TARGET) $^ $(LIBS)</p>
</blockquote>
<p>Jetzt sieht die Fehlermeldung etwas anders aus:</p>
<blockquote>
<p>/C++/GTestDemo&gt; make<br />
g++ -o MyClassTest MyClass.o MyClassTest.o -L/pfad/zu/gtest-1.6.0 -lgtest<br />
/pfad/zu/gtest-1.6.0/libgtest.a(gtest-all.o): In function <code>testing::internal::ThreadLocal&lt;testing::TestPartResultReporterInterface*&gt;::~ThreadLocal()': gtest-all.cc:(.text.\_ZN7testing8internal11ThreadLocalIPNS\_31TestPartResultReporterInterfaceEED2Ev\[\_ZN7testing8internal11ThreadLocalIPNS\_31TestPartResultReporterInterfaceEED5Ev\]+0x16): undefined reference to</code>pthread_getspecific'<br />
<a href="http://gtest-all.cc" rel="nofollow">gtest-all.cc</a>:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED2Ev[_ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEED5Ev]+0x2b): undefined reference to <code>pthread\_key\_delete' /pfad/zu/gtest-1.6.0/libgtest.a(gtest-all.o): In function</code>testing::internal::ThreadLocal&lt;std::vector&lt;testing::internal::TraceInfo, std::allocator<a href="testing::internal::TraceInfo" rel="nofollow">testing::internal::TraceInfo</a> &gt; &gt;::~ThreadLocal()':<br />
<a href="http://gtest-all.cc" rel="nofollow">gtest-all.cc</a>:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED2Ev[_ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEED5Ev]+0x16): undefined reference to <code>pthread_getspecific' gtest-all.cc:(.text.\_ZN7testing8internal11ThreadLocalISt6vectorINS0\_9TraceInfoESaIS3\_EEED2Ev\[\_ZN7testing8internal11ThreadLocalISt6vectorINS0\_9TraceInfoESaIS3\_EEED5Ev\]+0x2b): undefined reference to</code>pthread_key_delete'<br />
/pfad/zu/gtest-1.6.0/libgtest.a(gtest-all.o): In function <code>testing::internal::ThreadLocal&lt;std::vector&lt;testing::internal::TraceInfo, std::allocator&lt;testing::internal::TraceInfo&gt; &gt; &gt;::GetOrCreateValue() const': gtest-all.cc:(.text.\_ZNK7testing8internal11ThreadLocalISt6vectorINS0\_9TraceInfoESaIS3\_EEE16GetOrCreateValueEv\[testing::internal::ThreadLocal&lt;std::vector&lt;testing::internal::TraceInfo, std::allocator&lt;testing::internal::TraceInfo&gt; &gt; &gt;::GetOrCreateValue() const\]+0x18): undefined reference to</code>pthread_getspecific'<br />
<a href="http://gtest-all.cc" rel="nofollow">gtest-all.cc</a>:(.text._ZNK7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE16GetOrCreateValueEv[testing::internal::ThreadLocal&lt;std::vector&lt;testing::internal::TraceInfo, std::allocator<a href="testing::internal::TraceInfo" rel="nofollow">testing::internal::TraceInfo</a> &gt; &gt;::GetOrCreateValue() const]+0x7f): undefined reference to <code>pthread\_setspecific' /pfad/zu/gtest-1.6.0/libgtest.a(gtest-all.o): In function</code>testing::internal::ThreadLocal<a href="testing::TestPartResultReporterInterface*" rel="nofollow">testing::TestPartResultReporterInterface*</a>::CreateKey()':<br />
<a href="http://gtest-all.cc" rel="nofollow">gtest-all.cc</a>:(.text._ZN7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE9CreateKeyEv[testing::internal::ThreadLocal<a href="testing::TestPartResultReporterInterface*" rel="nofollow">testing::TestPartResultReporterInterface*</a>::CreateKey()]+0x16): undefined reference to <code>pthread\_key\_create' /pfad/zu/gtest-1.6.0/libgtest.a(gtest-all.o): In function</code>testing::internal::ThreadLocal&lt;std::vector&lt;testing::internal::TraceInfo, std::allocator<a href="testing::internal::TraceInfo" rel="nofollow">testing::internal::TraceInfo</a> &gt; &gt;::CreateKey()':<br />
<a href="http://gtest-all.cc" rel="nofollow">gtest-all.cc</a>:(.text._ZN7testing8internal11ThreadLocalISt6vectorINS0_9TraceInfoESaIS3_EEE9CreateKeyEv[testing::internal::ThreadLocal&lt;std::vector&lt;testing::internal::TraceInfo, std::allocator<a href="testing::internal::TraceInfo" rel="nofollow">testing::internal::TraceInfo</a> &gt; &gt;::CreateKey()]+0x16): undefined reference to <code>pthread\_key_create' /pfad/zu/gtest-1.6.0/libgtest.a(gtest-all.o): In function</code>testing::internal::ThreadLocal<a href="testing::TestPartResultReporterInterface*" rel="nofollow">testing::TestPartResultReporterInterface*</a>::GetOrCreateValue() const':<br />
<a href="http://gtest-all.cc" rel="nofollow">gtest-all.cc</a>:(.text._ZNK7testing8internal11ThreadLocalIPNS_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv[testing::internal::ThreadLocal<a href="testing::TestPartResultReporterInterface*" rel="nofollow">testing::TestPartResultReporterInterface*</a>::GetOrCreateValue() const]+0x16): undefined reference to <code>pthread_getspecific' gtest-all.cc:(.text.\_ZNK7testing8internal11ThreadLocalIPNS\_31TestPartResultReporterInterfaceEE16GetOrCreateValueEv\[testing::internal::ThreadLocal&lt;testing::TestPartResultReporterInterface*&gt;::GetOrCreateValue() const\]+0x7d): undefined reference to</code>pthread_setspecific'<br />
collect2: ld returned 1 exit status<br />
make: *** [MyClassTest] Error 1</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2139386</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139386</guid><dc:creator><![CDATA[XYZ2011]]></dc:creator><pubDate>Wed, 02 Nov 2011 14:45:50 GMT</pubDate></item><item><title><![CDATA[Reply to Was will mir der Compiler sagen on Wed, 02 Nov 2011 14:54:03 GMT]]></title><description><![CDATA[<p>Da scheint noch die Threadbibliothek zu felhen. -lpthread.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139391</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139391</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 02 Nov 2011 14:54:03 GMT</pubDate></item><item><title><![CDATA[Reply to Was will mir der Compiler sagen on Wed, 02 Nov 2011 15:02:08 GMT]]></title><description><![CDATA[<p>Ja, das wars. Vielen Dank.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139398</guid><dc:creator><![CDATA[XYZ2011]]></dc:creator><pubDate>Wed, 02 Nov 2011 15:02:08 GMT</pubDate></item><item><title><![CDATA[Reply to Was will mir der Compiler sagen on Wed, 02 Nov 2011 15:06:53 GMT]]></title><description><![CDATA[<p>Ist übrigens der Linker, der sich beschwert. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2139405</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2139405</guid><dc:creator><![CDATA[314159265358979]]></dc:creator><pubDate>Wed, 02 Nov 2011 15:06:53 GMT</pubDate></item></channel></rss>