clang++ exe error unable to execute command Couldnt execute program文件名或扩展名太长

本文介绍了一种在Visual Studio使用VisualGDB插件编译安卓工程时遇到的“命令行过长”错误的解决方案。通过添加虚拟的Cpp文件并给予超长的文件名,使编译器正确调用链接器,从而解决问题。

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

在VS中用VisualGDB插件编译安卓工程,莫名其妙突然出现以下报错:clang++.exe: error: unable to execute command: Couldn't execute program 'P:\android\android-ndk-r10e\toolchains\arm-linux-androideabi-4.8\prebuilt\windows-x86_64/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin\ld.exe'The filename or extension is too long.

一番Google之后找到了以下解决方法:

The problem is caused by a known miscalculation in clang's commandLineFitsWithinSystemLimits function which underestimates the command line length. To "fix" the issue, just add some dummy cpp files until so that even the incorrectly underestimated command line would exceed the platform limits. 2 - 5 dummy files should do it, or alternatively just one dummy with a long filename. This causes clang to invoke the linker with a command file like it should.

按照上面说的,在工程中增加了一个虚拟的Cpp文件,并且取了个超长的名字,比如 ThisIsADummyFileJustForAClangLinerError_DeleteThisAfterSolvingProblem.cpp

问题就解决了...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

逍遥游侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值