Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got C4275 warning when compiling using MSVC compiler #3415

Closed
EFanZh opened this issue May 22, 2021 · 0 comments
Closed

Got C4275 warning when compiling using MSVC compiler #3415

EFanZh opened this issue May 22, 2021 · 0 comments
Assignees
Labels

Comments

@EFanZh
Copy link

EFanZh commented May 22, 2021

Describe the bug

My C++ project (https://github.com/EFanZh/LeetCode/tree/master/c%2B%2B) fail to build after updating Google Test version because compiler generates C4275 warning.

Steps to reproduce the bug

On a Windows x64 OS:

  1. Install vcpkg, CMake and Visual Studio 2019 with MSVC compiler.

  2. Install Google Test with vcpkg install gtest --triplet x64-windows.

  3. Create a CMake project with two files:

    CMakeLists.txt:

    cmake_minimum_required(VERSION "3.15")
    project("foo")
    
    find_package("GTest" CONFIG REQUIRED)
    
    add_executable(foo main.cpp)
    target_compile_options("foo" PRIVATE "/W4" "/WX")
    target_link_libraries("foo" PRIVATE "GTest::gtest_main")

    main.cpp:

    #include <gtest/gtest.h>
  4. Run cmake -B build -D CMAKE_TOOLCHAIN_FILE=<VCPKG_TOOLCHAIN_FILE>, where <VCPKG_TOOLCHAIN_FILE> is this file from locally installed vcpkg.

  5. Run cmake --build build

Does the bug persist in the most recent commit?

Yes.

What operating system and version are you using?

Windows 10 x64 2004

What compiler and version are you using?

MSVC 19.28.29915.0

What build system are you using?

cmake version 3.19.20122902-MSVC_2

Additional context

Here is my CI failure log for reference: https://github.com/EFanZh/LeetCode/runs/2644255397.

@EFanZh EFanZh added the bug label May 22, 2021
EFanZh added a commit to EFanZh/LeetCode that referenced this issue May 22, 2021
@derekmauro derekmauro self-assigned this May 24, 2021
EFanZh added a commit to EFanZh/LeetCode that referenced this issue Oct 8, 2021
EFanZh added a commit to EFanZh/LeetCode that referenced this issue May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants