错误:
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
我试图依赖libsodium:https://download.libsodium.org/libsodium/releases/libsodium-1.0.17-stable-msvc.zip
使用以下Bazel配置:
# WORKSPACE
new_local_repository(
name = "org_libsodium_sodium",
build_file = "third_party/sodium.BUILD",
path = "third_party/sodium",
)
# sodium.BUILD
config_setting(
name = "windows_dbg_build",
constraint_values = ["@bazel_tools//platforms:windows"],
values = {"compilation_mode": "dbg"},
)
config_setting(
name = "windows_fastbuild_build",
constraint_values = ["@bazel_tools//platforms:windows"],
values = {"compilation_mode": "fastbuild"},
)
config_setting(
name = "windows_opt_build",
constraint_values = ["@bazel_tools//platforms:windows"],
values = {"compilation_mode": "opt"},
)
cc_library(
name = "sodium",
srcs = select({
":windows_dbg_build": ["lib/dbg/libsodium.lib"],
":windows_fastbuild_build": ["lib/dbg/libsodium.lib"],
":windows_opt_build": ["lib/opt/libsodium.lib"],
"//conditions:default": ["lib/opt/libsodium.a"],
}),
hdrs = glob(["sodium/**/*.h"]),
defines = ["SODIUM_STATIC"],
visibility = ["//visibility:public"],
)
对Windows预编译的静态库使用/MT
和/MTd
运行时库是否正确?
知道我在做什么错吗?
亲切的问候, 瑞安