Hi,
I’m compiling the google-test example, and I get the following error:
[org.gradle.internal.operations.logging.DefaultBuildOperationLoggerFactory] C:\Program Files\Jenkins\workspace\google-test\build\objs\operatorsTestGoogleTestExe\failing\operatorsTestCpp\cwowpojzjknsgr3i9evu64iig\test_plus.obj:test_plus.cpp:(.text+0x4f): undefined reference to `testing::Message::Message()'
It doesn’t complain about the include though, so that seems to work fine. If I change the filename it doesn’t work.
All I have in my test_main.cpp is:
#include "gtest/gtest.h"
using namespace testing;
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
and my build.gradle:
apply plugin: "cpp"
apply plugin: "google-test"
model {
flavors {
passing
failing
}
platforms {
x86 {
architecture "x86"
}
}
repositories {
libs(PrebuiltLibraries) {
googleTest {
headers.srcDir "libs/googleTest/1.7.0/include"
binaries.withType(StaticLibraryBinary) {
staticLibraryFile =
file("libs/googleTest/1.7.0/lib/" +
findGoogleTestCoreLibForPlatform(targetPlatform))
}
}
}
}
components {
operators(NativeLibrarySpec) {
targetPlatform "x86"
}
}
}
binaries.withType(GoogleTestTestSuiteBinarySpec) {
lib library: "googleTest", linkage: "static"
if (flavor == flavors.failing) {
cppCompiler.define "PLUS_BROKEN"
}
}
tasks.withType(RunTestExecutable) {
args "--gtest_output=xml:test_detail.xml"
}
def findGoogleTestCoreLibForPlatform(Platform platform) {
logger.info('Platform check')
if (platform.operatingSystem.windows) {
return "vs2013/gtest.lib"
} else if (platform.operatingSystem.macOsX) {
return "osx/libgtest.a"
} else {
return "linux/libgtest.a"
}
}
What could cause this?