| Author |
Message |
|
|
Posted: Jul 05, 2011 - 04:55 PM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
hi, i'm newbie here and avr.., i've some problem when i try to compile my source code..
.., there are like
Quote:
undefined reference to"Timer0_RegisterCallbackFunction",
undefined reference to"LCD_UpdateRequired", etc..
I attach the source code, i take this from bf_gcc with some editing cause i just need light meter code
thanks.. |
|
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 05:01 PM |
|


Joined: Jul 18, 2005
Posts: 62339
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
When you see "undefined reference" it's an error from the linker that says "all the .c and .S files in the project have been built to create .o files, I've then joined them all together but in there there are some calls to XXXXXXX which none of the .c or .S files provided".
In other words you forgot to add the .c files that provide Timer0_RegisterCallbackFunction() and LCD_UpdateRequired() to the list of .c files to be compiled. |
_________________
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 05:26 PM |
|


Joined: Nov 22, 2002
Posts: 12052
Location: Tangent, OR, USA
|
|
To expand a bit on Clawson's post, if you are using AVR studio, you need to add those .c files to the list of project files. In Studio4, that is done in the list of project files and there may be a way from the File menu to do that, also (Studio is not on the machine I am using right now). I don't remember the precise mechanism but it may use a right mouse-click on the project name, or something like that. In Studio5, I have no clue, but its probably something similar.
Cheers,
Jim |
_________________ Jim Wagner
Oregon Research Electronics, Consulting Div.
Tangent, OR, USA
"The only thing standing between us and victory is defeat" P.G.Wodhouse in Wooster & Jeeves series
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 05:39 PM |
|


Joined: Jul 18, 2005
Posts: 62339
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
I don't remember the precise mechanism but it may use a right mouse-click on the project name, or something like that.
Indeed it is then use "Add Existing Source File(s)..." and pick them in the resultant file selector. Life is simpler if they happen to be in the same directory as the other project files. |
_________________
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 05:40 PM |
|

Joined: Dec 16, 2005
Posts: 3089
Location: Bratislava, Slovakia
|
|
|
hakagiri wrote:
I attach the source code, i take this from bf_gcc
What is bf-gcc?
JW |
|
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 05:42 PM |
|


Joined: Jul 18, 2005
Posts: 62339
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
|
|
|
|
Posted: Jul 05, 2011 - 06:02 PM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
ok i'm trying it, thanks all  |
|
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 06:23 PM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
i've tried this option and get some error like no such file/directory but i've copied all .c and .h in one folder, so any solution for this??
thanks |
|
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 06:26 PM |
|

Joined: Nov 17, 2004
Posts: 13847
Location: Vancouver, BC
|
|
|
Quote:
but i've copied all .c and .h in one folder
But did you add those .c files to the project? |
_________________ Regards,
Steve A.
The Board helps those that help themselves.
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 06:43 PM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
|
Quote:
Quote:
but i've copied all .c and .h in one folder
But did you add those .c files to the project?
sure, i've.. that's make me confuse *_*'
MA |
|
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 06:44 PM |
|


Joined: Jul 18, 2005
Posts: 62339
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
|
Quote:
and get some error like no such file/directory
"some error" - very descriptive. Any chance of saying what "some error" actually is and I mean the EXACT wording. |
_________________
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 06:47 PM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
|
Quote:
../uvmeter.c:11:25: error: pgmspacehlp.h: No such file or directory
../uvmeter.c:15:18: error: main.h: No such file or directory
../uvmeter.c:16:17: error: ADC.h: No such file or directory
../uvmeter.c:17:17: error: BCD.h: No such file or directory
../uvmeter.c:18:27: error: LCD_functions.h: No such file or directory
../uvmeter.c:19:20: error: timer0.h: No such file or directory
that's error i get.. i've tried to move in same folder.. |
|
|
| |
|
|
|
|
|
Posted: Jul 05, 2011 - 07:08 PM |
|


Joined: Jul 18, 2005
Posts: 62339
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
OK now change:
Code:
#include <main.h>
#include <ADC.h>
#include <BCD.h>
#include <LCD_functions.h>
#include <timer0.h>
to be:
Code:
#include "main.h"
#include "ADC.h"
#include "BCD.h"
#include "LCD_functions.h"
#include "timer0.h"
and make sure the names on disk are exactly that case. |
_________________
|
| |
|
|
|
|
|
Posted: Jul 06, 2011 - 02:35 AM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
that's fix the problem, but another error come... like
Quote:
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr5/crtm169.o  .init9+0x0): undefined reference to `main'
button.o: In function `PinChangeInterrupt':
D:\BACKUP KULIAH\bahan TA\Program\uvmeter1\default/../button.c:162: undefined reference to `gPowerSaveTimer'
LCD_driver.o: In function `__vector_22':
D:\BACKUP KULIAH\bahan TA\Program\uvmeter1\default/../LCD_driver.c:299: undefined reference to `gAutoPressJoystick'
D:\BACKUP KULIAH\bahan TA\Program\uvmeter1\default/../LCD_driver.c:305: undefined reference to `gAutoPressJoystick'
thanks
best regards,
MA |
|
|
| |
|
|
|
|
|
Posted: Jul 06, 2011 - 09:11 AM |
|


Joined: Mar 27, 2002
Posts: 18576
Location: Lund, Sweden
|
|
|
Quote:
undefined reference to `main'
There is a generic explanation above on how to interpret 'undefined reference to something". Did you read it? Did you understand it?
In essence, when building the application a definition of the main function can not be found.
Have you supplied such a definition?
Have you added the file with that definition to the project?
Absolute base-line: Do you know that this function is needed in any and all C programs, and do you understand it's function? |
|
|
| |
|
|
|
|
|
Posted: Jul 06, 2011 - 01:37 PM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
i'll check again my source code...
thanks |
|
|
| |
|
|
|
|
|
Posted: Jul 06, 2011 - 03:41 PM |
|


Joined: Nov 17, 2004
Posts: 6137
Location: Great Smokey Mountains.
|
|
It seems to me that you've chopped up the original code provided by Martin Thomas without really understanding the basic principles for using AVRStudio to compile and link a program.
The Butterfly code has some very complex cross connections in the various modules. The relationship between the LCD and other modules is particularly fraught.
I'd strongly recommend that you read Dean's Butterfly LCD Tutorial: http://www.avrfreaks.net/index.php?name ... mp;t=36234 and get that working first. Then figure out how to use the ADC as a later issue.
Smiley |
_________________ FREE TUTORIAL: 'Quick Start Guide for Using the WinAVR C Compiler with ATMEL's AVR Butterfly' AVAILABLE AT: http://www.smileymicros.com
|
| |
|
|
|
|
|
Posted: Jul 06, 2011 - 03:44 PM |
|


Joined: Mar 27, 2002
Posts: 18576
Location: Lund, Sweden
|
|
|
Quote:
Then figure out how to use the ADC as a later issue.
[sarkasm]
Are you saying that there often is no such thing as immediate reward w/o any lengthy learning process involved?!?
I'm shocked and flabbergasted..
[/sarkasm] |
|
|
| |
|
|
|
|
|
Posted: Jul 06, 2011 - 04:35 PM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
i don't really understand about link a program
Quote:
I'd strongly recommend that you read Dean's Butterfly LCD Tutorial: http://www.avrfreaks.net/index.php?name ... mp;t=36234
i'll try it..
oh ya, i've try pc_comm from smileymicro tutorial, after download the code to butterfly, there's nothing apears on the hyper terminal...?? can u help?
best regards |
|
|
| |
|
|
|
|
|
Posted: Jul 06, 2011 - 05:55 PM |
|


Joined: Mar 27, 2002
Posts: 18576
Location: Lund, Sweden
|
|
|
Quote:
can u help?
Can: Maybe. Want to? No.
1. You are jumping from thing to thing here. You've now opened up the subject of smileymicros tutorial w/o the original question/problem being resolved. At our end this looks like you're abandoning the original problem, and we've spent time helping you in vain. Even if you've not abandoned the original problem, this discussion is now a "moving target". We loathe moving targets.
2. You are not supplying answers to questions asked. I was trying to determine your level of knowledge on the C language by asking about the main() function. You've not bothered to answer. So now we (still) don't know at what level we should supply help - obviously risking that help we give is not the one needed and out time wasted once again.
3. The formulation "there's nothing apears on the hyper terminal...?? can u help?" clearly indicates that you either can to do basic fault seeking, or could but haven't, or have but won't tell us. So once again, we need to start at some point, but you don't give us a chance determining where that is. Again any advice we give has a high likelyhood to be wasted.
No. I won't help.
Think about this: The quality of the answers you get is correlated with the quality of the question you ask. (Ask bad questions and people will walk away. Ask ood questions (and make good answers to counter/followup-quations!) and people will stay and help you.)
Me? I'm out of here. |
|
|
| |
|
|
|
|
|