簡體   English   中英

使用標頭交叉編譯應用程序和gcc錯誤的標頭

[英]Cross-compiling application and gcc using headers wrong headers

我正在嘗試使用x86-64 Ubuntu上的工具鏈交叉編譯arm7板。 我需要的標頭位於文件系統上:

.../include/<libdir1>
.../include/<libdir2>
[more]
.../include/<libdirN>

但是... / include目錄包含不兼容的標准頭文件(出於我無法控制的原因)。 使用-I選項會使gcc使用這些不兼容的標准標頭,而不是應使用的標頭。 在此之前用-I選項包括所有兼容的標准頭文件路徑也不起作用。

我要在本機編譯時和arm7板上使用相同的源路徑:

#include <libdir1/lib1.h>
#include <libdir2/lib2.h>
...
#include <libdirN/libN.h>

有沒有辦法使用當前存在的文件系統來執行此操作,還是需要將lib1,lib2,... libN頭文件完全復制到其他位置?

您可以使用-iquote選項:

僅在#include "file"'; they are not searched for的情況下,將目錄dir添加到要搜索頭文件的目錄列表的開頭#include "file"'; they are not searched for #include "file"'; they are not searched for #include',否則就像-I一樣。

因此,您可以使用""樣式包含指令來包含自定義標頭:

#include "libdir1/lib1.h"
#include "libdir2/lib2.h"

但是帶有<>樣式的標准標題:

#include <stdlib.h>

然后用-iquote而不是-I添加目錄:

-iquote../include

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM