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

在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

问题就解决了...

这个错误信息是由于在链接时无法找到指定的可执行文件导致的。具体来说,它指出无法链接到一个名为'/Users/apple/Library/Developer/Xcode/DerivedData/LePaiDemo-ftsuwgzvjdjwzghgkuefbzvdkvey/Build/Products/Debug-iphoneos/LePaiDemo.app/LePaiDemo'的可执行文件,原因是该文件不适用于架构armv7。同时,还出现了一个错误提示,即clang: error: unable to execute command: Segmentation fault (core dumped)。 这个错误通常是由于编译器或链接器的问题导致的。可能的原因包括编译器版本不兼容、编译选项设置错误、依赖库缺失或不匹配等。 为了解决这个问题,你可以尝试以下几个步骤: 1. 确保你使用的编译器版本与项目要求的兼容。你可以检查项目的编译设置,确保选择了正确的编译器版本。 2. 检查编译选项是否正确设置。你可以检查项目的构建设置,确保编译选项正确设置,并且没有冲突或错误。 3. 检查依赖库是否正确配置。你可以检查项目的依赖库设置,确保所有依赖库都正确添加,并且与项目的架构匹配。 4. 清理并重新构建项目。你可以尝试清理项目并重新构建,以确保所有编译和链接过程都能够正确执行。 如果以上步骤都没有解决问题,你可能需要进一步调查错误的具体原因,例如查看编译器或链接器的日志输出,以获取更多的信息。 #### 引用[.reference_title] - *1* [iOS 开发报错 clang: error: unable to execute command: Segmentation fault: 11](https://blog.csdn.net/u011496891/article/details/45098567)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

逍遥游侠

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

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

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

打赏作者

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

抵扣说明:

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

余额充值