Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Oct 25th, 2006, 2:58 PM   #1
sackarias
Programmer
 
sackarias's Avatar
 
Join Date: Jan 2006
Posts: 58
Rep Power: 3 sackarias is on a distinguished road
sparc error help!

I'm getting this error which I personally don't get much help from...

Undefined first referenced
symbol in file
i /var/tmp//ccchb2QW.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status

My code is...

/*********************************************
File: arrays.m
Date: October 31st, 2006
Author: Zack Hitz
Purpose: Asks the user to enter 10 integers
into 2 arrays.  The arrays will be added up
via their corresponding index, stored into 
a third array, then all 3 arrays will be
outputted.
*********************************************/
	.align 8
	.data
input:	.asciz	"%d"
	.align 8
output: .asciz 	"%d"
	.align 8
prompt: .asciz 	"Enter 10 integers\n"

!Automatic data for a program
define(idx, -20)
define(A, -60)
define(B, -100)
define(C, -140)

	.text
	.align 4
	.global main
main: save %sp,(-108 - 12) & -8, %sp

mov 0, %l0
st %l0, [%fp+idx]

set prompt, %o0
call printf
nop

inputLoop:

	set input, %o0
	add %fp, A, %o2
	ld [%fp+idx],%o1
	sll %o1, 2, %o1
	add %o2, %o1, %o1
	call scanf, 0
	nop

	ld [%fp+idx], %l0
	inc %l0
	st %l0, [%fp+idx] !was originally %fp+i
	cmp %l0, 10
	bl inputLoop
	nop

inputDone: call exit, 0
	mov 0, %o0

Any ideas?

*EDIT*
The boldfaced text is where the error was. I didn't have an "i" allocated anywhere so it freaked out, I meant idx.

Last edited by sackarias; Oct 25th, 2006 at 3:23 PM. Reason: Figured out error
sackarias is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:39 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC