GithubHelp home page GithubHelp logo

Comments (3)

derekmauro avatar derekmauro commented on June 14, 2024 1

We need more information. We have an MSVC build but we don't see this error. Given the macro definition that you supplied above it isn't obvious why we don't see the error. Can you provide a minimal example, build commands, exact error messages, and/or build logs?

from abseil-cpp.

noahbkim avatar noahbkim commented on June 14, 2024

I would have thought you could disable this with -D _CRT_USE_BUILTIN_OFFSETOF but I get

warning C4117: macro name '_CRT_USE_BUILTIN_OFFSETOF' is reserved, '#define' ignored

Edit: nvm that wouldn't make sense

from abseil-cpp.

noahbkim avatar noahbkim commented on June 14, 2024

Sorry, you're right! Here's a more detailed repro. It looks a little involved, but as far as I can tell, this is the canonical way to use Conan.

I have the following Conan profile (created by conan profile --detect --name debug and changing build_type=Release to build_type=Debug:

arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.version=193
os=Windows

Create a directory test with conanfile.txt:

[requires]
abseil/20230125.3

[generators]
CMakeDeps
CMakeToolchain

Run the following to install abseil via Conan:

test $ conan install . --build missing --output-folder conan-build-debug --profile debug

Create an example main.cpp script to compile:

#include <absl/containers/flat_hash_map.h>

int main() { return 0; }

A CMakeLists.txt:

cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 20)
project(test)

add_executable(main main.cpp)

find_package(absl REQUIRED)
target_link_libraries(main abseil::abseil)
target_include_directories(main PRIVATE ${absl_INCLUDE_DIRS})

Run cmake in a build directory, e.g. cmake-build-debug. I've included the top of my output for reference:

test\cmake-build-debug $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../conan-build-debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=debug
-- Building for: Visual Studio 17 2022
-- Using Conan toolchain: E:/Repositories/noahbkim/test/conan-build-debug/conan_toolchain.cmake
-- Conan toolchain: C++ Standard 20 with extensions OFF
-- The C compiler identification is MSVC 19.37.32824.0
-- The CXX compiler identification is MSVC 19.37.32824.0
...

Build; I've included output

test\cmake-build-debug $ cmake --build .
MSBuild version 17.7.2+d6990bcfa for .NET Framework
 
  main.cpp
~\.conan2\p\b\abseiebe27282a3fe3\p\include\absl/strings/internal/cord_rep_flat.h(45,39): error C2131: e
xpression did not evaluate to a constant [test\cmake-build-debug\main.vcxproj]
~\.conan2\p\b\abseiebe27282a3fe3\p\include\absl/strings/internal/cord_rep_flat.h(45,39): message : a no
n-constant (sub-)expression was encountered [test\cmake-build-debug\main.vcxproj]
~\.conan2\p\b\abseiebe27282a3fe3\p\include\absl/strings/cord_buffer.h(327,31): error C2131: expression
did not evaluate to a constant [test\cmake-build-debug\main.vcxproj]
~\.conan2\p\b\abseiebe27282a3fe3\p\include\absl/strings/cord_buffer.h(327,31): message : failure was ca
used by non-constant arguments or reference to a non-constant symbol [test\cmake-build-debug\m
ain.vcxproj]
~\.conan2\p\b\abseiebe27282a3fe3\p\include\absl/strings/cord_buffer.h(327,31): message : see usage of '
absl::lts_20230125::CordBuffer::Rep::Short::raw_size' [test\cmake-build-debug\main.vcxproj]

from abseil-cpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.