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

使用std模块时构建失败 #3463

Closed
hackermdch opened this issue Mar 6, 2023 · 2 comments
Closed

使用std模块时构建失败 #3463

hackermdch opened this issue Mar 6, 2023 · 2 comments
Labels
Milestone

Comments

@hackermdch
Copy link

hackermdch commented Mar 6, 2023

Xmake 版本

v2.7.7+dev.8c1523adb

操作系统版本和架构

Windows 11 21H2 + VS2022 17.5.1

描述问题

使用debug或release配置进行首次构建可以成功,但之后切换到release或debug再次构建出现链接错误

期待的结果

正常构建

工程配置

simple.zip
运行build.bat可重现错误

附加信息和错误日志

[  0%]: generating.module.deps test\test.cpp
[  0%]: generating.module.deps src\mod.ixx
[  0%]: generating.module.deps src\mod.cpp
[  5%]: compiling.module.debug std
[ 11%]: compiling.module.debug std.compat
[ 11%]: compiling.module.debug mod
[ 35%]: compiling.debug src\mod.cpp
[ 41%]: archiving.debug lib.lib
[ 82%]: compiling.debug test\test.cpp
[ 88%]: linking.debug bin.exe
error: std.ixx.ifc.obj : error LNK2005: "char * __cdecl std::ctime(__int64 const * const)" (?ctime@std@@YAPEADQEB_J@Z::) 已经在 std.ixx.ifc.obj 中定义
std.ixx.ifc.obj : error LNK2005: "double __cdecl std::difftime(__int64,__int64)" (?difftime@std@@YAN_J0@Z::) 已经在 std.ixx.ifc.obj 中定义
std.ixx.ifc.obj : error LNK2005: "struct tm * __cdecl std::gmtime(__int64 const * const)" (?gmtime@std@@YAPEAUtm@@QEB_J@Z::) 已经在 std.ixx.ifc.obj 中定 义
std.ixx.ifc.obj : error LNK2005: "struct tm * __cdecl std::localtime(__int64 const * const)" (?localtime@std@@YAPEAUtm@@QEB_J@Z::) 已经在 std.ixx.ifc.obj 中定义
std.ixx.ifc.obj : error LNK2005: "__int64 __cdecl std::mktime(struct tm * const)" (?mktime@std@@YA_JQEAUtm@@@Z::) 已经在 std.ixx.ifc.obj 中定义
std.ixx.ifc.obj : error LNK2005: "__int64 __cdecl std::time(__int64 * const)" (?time@std@@YA_JQEA_J@Z::) 已经在 std.ixx.ifc.obj 中定义
std.ixx.ifc.obj : error LNK2005: "int __cdecl std::timespec_get(struct timespec * const,int)" (?timespec_get@std@@YAHQEAUtimespec@@H@Z::) 已经在 std.ixx.ifc.obj 中定义
build\windows\x64\debug\bin.exe : fatal error LNK1169: 找到一个或多个多重定义的符号"
@hackermdch hackermdch added the bug label Mar 6, 2023
waruqi added a commit that referenced this issue Mar 8, 2023
@waruqi
Copy link
Member

waruqi commented Mar 8, 2023

再试试

xmake update -s dev

记得先清下缓存

@waruqi waruqi added this to the v2.7.8 milestone Mar 8, 2023
@hackermdch
Copy link
Author

好,没问题了

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