error L NK2005

本文介绍了一个关于MSVCRTD.lib(MSVCP100D.dll)中出现的LNK2005错误,并详细说明了错误的原因在于gtest项目与测试项目的运行库配置不一致导致的问题。通过将测试项目的运行库配置从MDd改为MTd来解决了这一问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 博客分类: error 1>msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::endl(class std::basic_ostream<char,struct std::char_traits<char> > &)" (?endl@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z) already defined in ComputerServer_C.obj    Monday, June 21, 2010  msvcprtd.lib(MSVCP100D.dll) : error LNK2005: already defined in gtestd.lib(gtest.obj)  This error occurs when the C/C++ Code Generation Runtime Library in gtest is defined differently from testing code using it.  The gtest project was defined as MTd (Multi-threaded Debug) and the testing project defined as MDd (Multi-threaded DLL).   Fix:  Changed the testing project to use MTd.  From the Property Pages select Configuration Properties ==> C/C++ ==> Code Generation ==> Runtime Library ==> Multi-threaded (/MT).  
编译时报错:gcc.exe C:\Users\25772\Desktop\gui\main.c -o app.exe -I./glfw/include -I./nuklear -L./glfw/lib-mingw-w64 -lglfw3 -lopengl32 -lgdi32 -Wl,--subsystem,windows -static -o main gcc.exe C:\Users\25772\Desktop\gui\main.c -o app.exe -I./glfw/include -I./nuklear -L./glfw/lib-mingw-w64 -lglfw3 -lopengl32 -lgdi32 -Wl,--subsystem,windows -static -o main C:\Users\25772\Desktop\gui\main.c: In function 'main': C:\Users\25772\Desktop\gui\main.c:32:30: error: implicit declaration of function 'nk_glfw3_init' [-Wimplicit-function-declaration] 32 | struct nk_context *ctx = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); | ^~~~~~~~~~~~~ C:\Users\25772\Desktop\gui\main.c:32:52: error: 'NK_GLFW3_INSTALL_CALLBACKS' undeclared (first use in this function) 32 | struct nk_context *ctx = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\25772\Desktop\gui\main.c:32:52: note: each undeclared identifier is reported only once for each function it appears in C:\Users\25772\Desktop\gui\main.c:34:5: error: implicit declaration of function 'nk_glfw3_font_stash_begin' [-Wimplicit-function-declaration] 34 | nk_glfw3_font_stash_begin(&atlas); | ^~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\25772\Desktop\gui\main.c:35:5: error: implicit declaration of function 'nk_glfw3_font_stash_end' [-Wimplicit-function-declaration] 35 | nk_glfw3_font_stash_end(); | ^~~~~~~~~~~~~~~~~~~~~~~ C:\Users\25772\Desktop\gui\main.c:39:9: error: implicit declaration of function 'nk_glfw3_new_frame' [-Wimplicit-function-declaration] 39 | nk_glfw3_new_frame(); | ^~~~~~~~~~~~~~~~~~ C:\Users\25772\Desktop\gui\main.c:46:62: error: passing argument 4 of 'nk_edit_string' from incompatible pointer type [-Wincompatible-pointer-types] 46 | nk_edit_string(ctx, NK_EDIT_FIELD, input_buffer, &input_buffer[255], 255, nk_filter_default); | ^~~~~~~~~~~~~~~~~~ | | | char * In file included from C:\Users\25772\Desktop\gui\main.c:6: ./nuklear/nuklear.h:28511:24: note: expected 'int *' but argument is of type 'char *' 28511 | char *memory, int *len, int max, nk_plugin_filter filter) | ~~~~~^~~ C:\Users\25772\Desktop\gui\main.c:60:9: error: implicit declaration of function 'nk_glfw3_render' [-Wimplicit-function-declaration] 60 | nk_glfw3_render(NK_ANTI_ALIASING_ON); | ^~~~~~~~~~~~~~~ C:\Users\25772\Desktop\gui\main.c:64:5: error: implicit declaration of function 'nk_glfw3_shutdown' [-Wimplicit-function-declaration] 64 | nk_glfw3_shutdown(); | ^~~~~~~~~~~~~~~~~
04-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值