From 32ba8bc89f8623abefbba092e8866719796136d8 Mon Sep 17 00:00:00 2001 From: Krishna <41564221+krishna116@users.noreply.github.com> Date: Thu, 20 Aug 2026 07:09:50 +0800 Subject: [PATCH] Update CMakeLists.txt to Fix link warning LNK4098. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Englisth] I encountered this issue while using the statically compiled utf8proc (version 2.11.3): LINK: warning LNK4098: The default library “MSVCRT” conflicts with other libraries; please use /NODEFAULTLIB:library Here is the solution provided by AI: When you encounter the message “The default library ‘MSVCRT’ conflicts with other libraries” while using a static C++ library, it is usually because the static library is linked to a C runtime library (CRT) that is incompatible with your project. To resolve this issue, you need to ensure that the static library does not statically link the CRT, but instead depends on the version of the CRT used by your project. [Chinese] 我使用静态编译的utf8proc(version 2.11.3)遇到这个问题:LINK : warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library 以下是AI给出的解决方案: 在使用静态C++库时遇到“默认库‘MSVCRT’与其他库的使用冲突”提示,通常是因为该静态库链接了与您的项目不兼容的C运行时库(CRT)。要解决这个问题,您需要确保静态库不静态链接CRT,而是依赖于您的项目所使用的CRT版本。 --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75d5b7d..ca9e174 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ else() target_compile_definitions(utf8proc PUBLIC "UTF8PROC_STATIC") if (MSVC) set_target_properties(utf8proc PROPERTIES OUTPUT_NAME "utf8proc_static") + target_link_options(utf8proc PRIVATE "/NODEFAULTLIB:library") endif() endif()