Can't use a function more than once

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
yimtaka
Posts: 8
Joined: Thu Aug 09, 2007 6:12 pm

Can't use a function more than once

Post by yimtaka »

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.
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

could you post the output here? and maybe the whole source+make
Slash
Posts: 26
Joined: Sun Jan 07, 2007 9:04 pm

Re: Can't use a function more than once

Post by Slash »

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:
int tval=testF();
int tval2=testF();
to...
int tval=testF(x);
int tval2=testF(x);
where X is a number.
yimtaka
Posts: 8
Joined: Thu Aug 09, 2007 6:12 pm

Post by yimtaka »

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?
yimtaka
Posts: 8
Joined: Thu Aug 09, 2007 6:12 pm

Re: Can't use a function more than once

Post by yimtaka »

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:
int tval=testF();
int tval2=testF();
to...
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.
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

You'll have to post the full code and error output; you haven't given us enough information to answer.
yimtaka
Posts: 8
Joined: Thu Aug 09, 2007 6:12 pm

Post by yimtaka »

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.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

I guess, its an alias optimization issue.
Post Reply