Compiler-explorer: [BUG] gtest libraries not linked

Created on 13 Jul 2020  路  3Comments  路  Source: compiler-explorer/compiler-explorer

It appears that the Google Test libraries are not being added to the compiler arguments, causing the linker to fail to resolve some necessary symbols.

#include <gtest/gtest.h>

TEST(link, please)
{
}

In this snippet, the compiler (or more specifically the linker) complains about the main function being undefined, although typically this function is defined in the gtest_main library that comes with Google Test.

I believe the Google Test libraries that should be added are gtest, gtest_main, gmock and gmock_main.

Note that the Google Test _headers_ are found correctly, since the include path is passed to the compiler arguments. The missing part is the actual library binaries (.a or .so files).

bug

All 3 comments

This mainly happens because we currently don't support library binaries and linking to them.

cough don't tell anyone, but try it on beta https://godbolt.org/beta/z/9c6jbY cough

Oh, I see. Using the beta then. Thanks!

The beta site might go down at any point, but...we hope to have this ready for prime time soon :) Closing as a duplicate of #1932

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adiba picture adiba  路  4Comments

mathbunnyru picture mathbunnyru  路  4Comments

LadaF picture LadaF  路  4Comments

Slabity picture Slabity  路  3Comments

phuclv90 picture phuclv90  路  4Comments