Skip to content

Unable to compile GTests with MSVS and Clang; multiple undefined symbol... #4392

Closed Answered by snealbli
snealbli asked this question in Community Help
Discussion options

You must be logged in to vote

I fixed it for myself. Like any good programmer I will post the solution to save any future programmers aggravation.

Did not work:

  1. Building gtest and gmock with MSVS and using just about every possible combination of compilers, compiler options, MSVS options

    • Same errors as in OP
  2. Building gtest and gmock separately using CMake

    • Same errors as in OP

Worked

  1. Built WITH gtest/gmock as a dependency.
    • Navigate to project folder with CMakeList.txt and then in cmd: cmake -S . -B build && cmake --build build && cd build && ctest
    • FIXED!!!

CMakeList.txt (root CMakeList)

cmake_minimum_required(VERSION 3.20)

# I. GLOBAL VARIABLES
###########################################################…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by snealbli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant