未定义参考AVR-GCC [英] Undefined reference to in AVR-GCC

查看:143
本文介绍了未定义参考AVR-GCC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的main.c是如下

My main.c is as below

#include <avr/io.h>
#include<avr/interrupt.h>
#include<util/delay.h>
#include <string.h>
#include "main.h"
#include "globle.h"
#include "LCD.h"

int  main()

{

...
...
...

lcdInit(0xc0);
lcdScreen(0);
.
.
.


return 0; 

}

lcdInit(将0xC0)的定义;和lcdScreen(0);在我可见的lcd.c文件
我也有如下的头文件lcd.h用于:

The definition of lcdInit(0xc0); and lcdScreen(0); is in my lcd.c file and I have a header file lcd.h having the following lines:

void lcdInit(char);
void lcdScreen(char);

不过还是我越来越:

But still I am getting:

C:\\ Documents和Settings \\ Tanv \\我的文档\\ my_project5 \\默认/../ MAIN.C:95:>未定义>参考
  `lcdInit

C:\Documents and Settings\Tanv\My Documents\my_project5\default/../Main.c:95: >undefined >reference to `lcdInit'

C:\\ Documents和Settings \\ Tanvr \\我
  文档\\ my_project5 \\默认/../ MAIN.C:96:未定义引用
  `lcdScreen

C:\Documents and Settings\Tanvr\My Documents\my_project5\default/../Main.c:96: undefined reference to `lcdScreen'

什么是错在这里?

推荐答案

这是一个链接错误。

您没有正确建立你的计划,你需要编译所有的C文件放在一起,就像这样:

You are not building your program properly, you need to compile all C files together, like so:

$ gcc-avr -o program main.c lcd.c

或共同目标文件,如果您单独编译链接它们。

or link them together from object files if you compile separately.

这篇关于未定义参考AVR-GCC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆