gpt4 book ai didi

c - 链接器错误 "cannot find -l/some/path/libfilename"

转载 作者:行者123 更新时间:2023-11-30 20:26:47 25 4
gpt4 key购买 nike

我已经在 Windows 中设置了 Eclipse 并尝试编译与 POS 设备相关的简单代码,但出现错误,代码是:

#include <posapi.h>
#include <printer.h>
#include <stdio.h>
#include <stdlib.h>

int main(void) {

printf ("Beeping...");
beep(100,2000);
printf("Stop Beeping.");

return 0;
}

错误是:

cannot find -l/cygdrive/d/Docs/SDK/SDK/Windows/sdk-new8210-1.0.0/sdk/lib/libpos.so
<小时/>

[评论更新]

这是命令行:

/cygdrive/c/glibc-oabi-toolchain-arm-generic/bin/arm-unknown-linux-gnu-gcc -I"C:\cygwin\usr\include" -I"D:\Docs\SDK\SDK\Windows\sdk-new8210-1.0.0\sdk\include" -I"D:\Docs\SDK\SDK\Windows\sdk-new8210-1.0.0\sdk\include\directfb" -O0 -g3 -Wall -c -fmessage-length=0 -Wundef -Wstrict-prototypes -Werror-implicit-function-declaration -Wdeclaration-after-statement -fsigned-char -marm -mapcs -mno-sched-prolog -mabi=apcs-gnu -mlittle-endian -mno-thumb-interwork -msoft-float -MMD -MP -MF"src/DemoApp5.d" -MT"src/DemoApp5.d" -o "src/DemoApp5.o" "../src/DemoApp5.c" 

最佳答案

链接器选项-l不通过“路径/文件名”指定库,而仅通过其名称指定库。这是删除了前导“lib”的文件名。在你的情况下,它将是

-lpos

要另外指定搜索路径,请使用选项-L(在引用-l选项之前)。所以在你的情况下这可能是:

-Ld/Docs/SDK/SDK/Windows/sdk-new8210-1.0.0/sdk/lib/ -lpos

(-L-l 可以多次使用)

关于c - 链接器错误 "cannot find -l/some/path/libfilename",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24096083/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com