- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在对微 Controller 进行编程。我使用 VisualStudio 2010 创建所有代码,现在,在微 Controller 上使用相同的代码,我收到此错误:
...
./src/main.o:(.rodata.GPS_latitude+0x0): multiple definition of `GPS_latitude'
./src/empresa1.o:(.rodata.GPS_latitude+0x0): first defined here
./src/main.o:(.rodata.GPS_hora+0x0): multiple definition of `GPS_hora'
./src/empresa1.o:(.rodata.GPS_hora+0x0): first defined here
./src/gps.o: In function `GPS_PreencheCampos':
gps.c:(.text.GPS_PreencheCampos+0x4): undefined reference to `GPS_GuardaAnterior'
./src/main.o: In function `main':
main.c:(.text.startup.main+0xa0): undefined reference to `GPS_PegaValorLatitude'
main.c:(.text.startup.main+0xa4): undefined reference to `GPS_PegaLatitudeInt'
main.c:(.text.startup.main+0xc0): undefined reference to `GPS_PegaValorLongitude'
main.c:(.text.startup.main+0xc4): undefined reference to `GPS_PegaLongitudeInt'
main.c:(.text.startup.main+0xf8): undefined reference to `GPS_PegaHoraInt'
main.c:(.text.startup.main+0x110): undefined reference to `GPS_PegaStatusInt'
main.c:(.text.startup.main+0x128): undefined reference to `GPS_PegaModoInt'
main.c:(.text.startup.main+0x140): undefined reference to `GPS_PegaSatelitesInt'
collect2: ld returned 1 exit status
make: *** [TFRT_Leandro.axf] Error 1
一开始我们可以看到有一些“多重定义”的错误消息。所有这些消息都与 .h 文件中定义的变量有关。它们的定义如下:GPS_data:
struct {
char data[7]; // Data no formato ddMMyy\0
char hora[7]; // Hora no formato hhmmss\0
char latitude[10]; // Latitude no formato ddmm.mmmm\0
char longitude[11]; // Longitude no formato dddmm.mmmm\0
char velocidade[6]; // Velocidade no formato sss.s\0
char curso[6]; // Curso no formato ccc.c\0
char satelites[3]; // Número de satélites no formato nn\0
char status[2]; // Qualidade do GPS Invalido(0), Valido GNSS fixo(1) ou Valido GNSS fixo diferencial(2)
char norteSul[2]; // Direção de latitude (N/S)
char lesteOeste[2]; // Direção de longitude (E/W)
char modo[2]; // Modo: Sem fixo disponível (1), 2D (2), 3D (3)
} GPS_Info;
typedef struct GPS_Dado{
int origem;
int posicao;
int tamanho;
char * pDado;
};
const struct GPS_Dado GPS_hora = {GPS_Tipo_GPRMC, 0, 7, GPS_Info.hora};
我们可以注意到的另一件事是,存在对函数的 undefined reference 。我不明白。每个函数在头文件中都有声明,该声明已正确包含在文件 main.c 中。
我希望有人能帮助我解决这个错误。好吧,关于这个疑问的任何其他问题请随时在评论中提问。
最诚挚的问候
最佳答案
你不应该在头文件中定义变量和常量,而只能声明它们:
extern const struct GPS_Dado GPS_hora;
然后在实现(.c
)文件中定义它:
const struct GPS_Dado GPS_hora = { GPS_Tipo_GPRMC, 0, 7, GPS_Info.hora };
关于c - 再次收集2 : ld returned 1 exit status,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15625277/
我正在尝试创建尽可能小的 ELF。我创建了一个这样的测试文件(NASM 语法): SECTION .text dd 0xdeadbeef 使用此链接描述文件: SECTIONS { .text
GNU LD 链接器命令语言是否有条件语句? 背景:我正在为 arm cortex m0+ 开发固件,该固件由引导加载程序和应用程序组成。两者都在单独的项目中进行编译和刷新,但我使用了一个框架,其中包
我很确定 ld 有一个手册页链接器脚本语法,但我找不到它。 最佳答案 如果您更喜欢比 info 更方便的东西, 这是一个可浏览的 HTML 版本:ld.info: Scripts .但它可能不是完全最
谁能解决这个练习,这样我就能明白我错在哪里,因为有太多的 LOL 变量。 生成一个 C 代码,将其放在以下表达式之前 printf ("% ld% ld% ld \ n", lol, & lol, *
在他关于理解 Linux Kernel Initcall Mechanism 的文章中, Trevor 创建了一个用户空间程序来模拟调用 linux 驱动程序的 init_module() 的机制。
/usr/bin/ld: cannot find -ldlib /usr/bin/ld: cannot find -lcblas /usr/bin/ld: cannot find -llapack 在
我想以 json-ld 格式创建一组人,但我需要保留一些键而不是使用数组,所以我首先尝试了这个: { "@context" : { "@base" : "http://www.exampl
所以我试图围绕 JSON-LD 进行思考,我看到的所有示例主要包括嵌入“链接数据”。但我想提供对链接数据的引用(主要是因为嵌入所有数据可能会产生 10MB 的有效负载)。所以我想知道我这样做是否正确。
我在这里复制了 json-ld standard 中的示例的一部分: { "@context": { "foaf": "http://xmlns.com/foaf/0.1/", "
考虑这样一个程序: #include void foo() __attribute__((__weak__)); int main() { printf("%p\n", (void *)fo
我正在尝试使用一个名为 GLV 的小部件库对于我正在开发的应用程序。我正在运行 Linux Mint 17。我安装了所有库并成功构建了 GLV 库,但是当我尝试运行已构建的示例之一时,出现了此共享库错
在将未编辑的 JSON 数据转换为 JSON-LD 时,使用前缀和数据值为对象构造 IRI 时遇到问题。我运行的示例代码是: { "@context" : { "prefix" : "
假设我有一个 JSON 对象,它在嵌套对象中包含一些属性。 { "title": "My Blog Post", "meta": { "publishedAt": "2
我是 JSON-LD 和 LOD 的新手,所以请原谅我使用的术语。我正致力于在 JSON-LD 中创建数据模型,以描述基于欧洲数据模型 (http://pro.europeana.eu/edm-doc
我有一个玩具 x86 汇编程序,我正在用 as 编写和编译它和 ld : .text .global _start _start: movq $1, %rax movq
我正在尝试创建 Google 的结构化数据,但不知道我在做什么。我将其设置为一个组织,然后将 SD 标记工具用于我的所有产品。我将每个 JSON-LD 产品直接从标记工具而不是嵌套放入它自己的脚本标签
我正在尝试创建 Google 的结构化数据,但不知道我在做什么。我将其设置为一个组织,然后将 SD 标记工具用于我的所有产品。我将每个 JSON-LD 产品直接从标记工具而不是嵌套放入它自己的脚本标签
我正在尝试使用 vcpkg 和 ndk r20 为 android arm 构建 tesseract我必须编辑 CMakeLists.txt 并添加 glob.c 和 glob.h,因为它们不在 nd
长话短说: 有没有办法让我(没有 root 访问权限)使链接器(由 gcc 调用)不知道 /etc/ld.so.conf 中包含的目录的内容 在通过 ldconfig 缓存之后? 详细说明: 我正在尝
我想将/opt/vertica/lib64 添加到系统库路径中,所以我执行以下步骤: (1) 将/opt/vertica/lib64加入/etc/ld.so.conf,运行ldconfig, (2)
我是一名优秀的程序员,十分优秀!