| View previous topic :: View next topic |
| Author |
Message |
yimtaka
Joined: 09 Aug 2007 Posts: 8
|
Posted: Thu Aug 09, 2007 6:21 pm Post subject: Can't use a function more than once |
|
|
Hi all,
I am new to the forum and have just started development for the PSP. I am using devkitpro to develop for the PSP.
I have created a function and if I call that function more than once, when trying to compile I get the error:
.ent or .aent not in text section
.end not in text section
operation combines symbols in different segments
an example of a function is:
int testF(int val)
{
return val*2;
}
if I call the above function such as:
int tval=testF();
it works but if I call it twice:
int tval=testF();
int tval2=testF();
and the code doesn't compile.
Sorry if the answer exists already, I tried searching but didn't find anything. |
|
| Back to top |
|
 |
rapso
Joined: 28 Mar 2005 Posts: 147
|
Posted: Thu Aug 09, 2007 6:25 pm Post subject: |
|
|
| could you post the output here? and maybe the whole source+make |
|
| Back to top |
|
 |
Slash
Joined: 07 Jan 2007 Posts: 26
|
Posted: Thu Aug 09, 2007 6:30 pm Post subject: Re: Can't use a function more than once |
|
|
| yimtaka wrote: | Hi all,
I am new to the forum and have just started development for the PSP. I am using devkitpro to develop for the PSP.
I have created a function and if I call that function more than once, when trying to compile I get the error:
.ent or .aent not in text section
.end not in text section
operation combines symbols in different segments
an example of a function is:
int testF(int val)
{
return val*2;
}
if I call the above function such as:
int tval=testF();
it works but if I call it twice:
int tval=testF();
int tval2=testF();
and the code doesn't compile.
Sorry if the answer exists already, I tried searching but didn't find anything. |
Your function requires an int value. So you have to change it from:
| Quote: | int tval=testF();
int tval2=testF(); |
to...
| Quote: | int tval=testF(x);
int tval2=testF(x); |
where X is a number. |
|
| Back to top |
|
 |
yimtaka
Joined: 09 Aug 2007 Posts: 8
|
Posted: Thu Aug 09, 2007 6:30 pm Post subject: |
|
|
Sorry I can't at the moment as I am at work. I used the sample from the SDK folder called ortho in the GU folder. I just added a function to it.
Could I be missing something in the make file? |
|
| Back to top |
|
 |
yimtaka
Joined: 09 Aug 2007 Posts: 8
|
Posted: Thu Aug 09, 2007 6:31 pm Post subject: Re: Can't use a function more than once |
|
|
| Slash wrote: | | yimtaka wrote: | Hi all,
I am new to the forum and have just started development for the PSP. I am using devkitpro to develop for the PSP.
I have created a function and if I call that function more than once, when trying to compile I get the error:
.ent or .aent not in text section
.end not in text section
operation combines symbols in different segments
an example of a function is:
int testF(int val)
{
return val*2;
}
if I call the above function such as:
int tval=testF();
it works but if I call it twice:
int tval=testF();
int tval2=testF();
and the code doesn't compile.
Sorry if the answer exists already, I tried searching but didn't find anything. |
Your function requires an int value. So you have to change it from:
| Quote: | int tval=testF();
int tval2=testF(); |
to...
| Quote: | int tval=testF(x);
int tval2=testF(x); |
where X is a number. |
yes you're right, it's my mistake typing the example but even that produces the same error. |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri Aug 10, 2007 2:47 am Post subject: |
|
|
| You'll have to post the full code and error output; you haven't given us enough information to answer. |
|
| Back to top |
|
 |
yimtaka
Joined: 09 Aug 2007 Posts: 8
|
Posted: Fri Aug 10, 2007 5:49 pm Post subject: |
|
|
| it's working now!. I removed the -O2 parameter from the makefile and it compiles and works on my psp now. Sorry for the lack of information. |
|
| Back to top |
|
 |
KickinAezz
Joined: 03 Jun 2007 Posts: 328
|
Posted: Sun Aug 12, 2007 12:40 am Post subject: |
|
|
| I guess, its an alias optimization issue. |
|
| Back to top |
|
 |
|