User forums > Using Code::Blocks
Using Google Test with C::B
(1/1)
husamettinor:
Hello everyone,
I have a basic problem with using google test framework with Code::Blocks on Windows. I've searched but couldn't find needed steps on the internet. I have included needed paths and libgtest.a but still have undefined reference errors whenever I am trying to run.
//
#include "gtest/gtest.h"
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
//
I run this code and got the messages,
obj\Debug\main.o||In function `main':|
C:\Users\Merve\Desktop\Dummy\main.cpp|4|undefined reference to `testing::InitGoogleTest(int*, char**)'|
obj\Debug\main.o||In function `Z13RUN_ALL_TESTSv':|
C:\googletest\include\gtest\gtest.h|2233|undefined reference to `testing::UnitTest::GetInstance()'|
C:\googletest\include\gtest\gtest.h|2233|undefined reference to `testing::UnitTest::Run()'|
Thanks.
oBFusCATed:
You have to link to the library or add the library cpp files to your project.
husamettinor:
--- Quote from: oBFusCATed on January 07, 2017, 02:51:33 am ---You have to link to the library or add the library cpp files to your project.
--- End quote ---
I did but still have the same problem. Can you explain step by step?
stahta01:
--- Quote from: husamettinor on January 20, 2017, 12:49:42 pm ---
--- Quote from: oBFusCATed on January 07, 2017, 02:51:33 am ---You have to link to the library or add the library cpp files to your project.
--- End quote ---
I did but still have the same problem. Can you explain step by step?
--- End quote ---
Post the current full "Build Log" or most of us will just ignore you.
http://wiki.codeblocks.org/index.php/FAQ#Compiling_.28errors.29
ALSO WHEN REPLYING TO AN EITHER OR DIRECTIONS: State what option you followed!!
Tim S.
Navigation
[0] Message Index
Go to full version