• Steam recently changed the default privacy settings for all users. This may impact tracking. Ensure your profile has the correct settings by following the guide on our forums.

psp programing.com lesson 3 help

pcstalljr

teen! hide your daughters
This is becoming a big pain. i put the code as said. and i get these errors.
1 error: '$pad' undeclared (first use in this function) 76 pspprogram
2 error: (Each undeclared identifier is reported only once 76 pspprogram
3 error: for each function it appears in.) 76 pspprogram
4 warning: too many arguments for format 88 pspprogram
5 warning: value computed is not used 92 pspprogram
6 warning: value computed is not used 92 pspprogram
7 error: expected ';' before ')' token 92 pspprogram
8 error: expected expression before ')' token 92 pspprogram
9 warning: implicit declaration of function 'sceDisplaywaitVblankStart' 94 pspprogram
10 warning: too many arguments for format 100 pspprogram

and my code is:
[highlight=c]
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>

PSP_MODULE_INFO("hello",0,1,1);

#define print pspDebugScreenPrintf

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;

cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);

sceKernelSleepThreadCB();

return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;

thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}

return thid;
}



int main()
{
//start starting
pspDebugScreenInit();
SetupCallbacks();

//do your code!
int counter = 0;
int i = 0;
SceCtrlData pad;



print("Press [X] to start the timer!");

//while loop for [X] button press
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS)
{
break;
}
}

//while loop for [O] button press
while(1)
{
sceCtrlReadBufferPositive($pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE)
{
break;
}


//clear the screen
pspDebugScreenClear();

//new readout. notice "\n" for Newline
print("oki do! now press [O] to stop the timer.\n");
print("Counter: $I", counter);

//add one to "counter"
counter++;

//pause so "HOME" button can work
for(i=0, i<10,i++)
{
sceDisplaywaitVblankStart();
}
}

//clear debug screen
pspDebugScreenClear();


print("Timer finished!\n");
print("Final count: $i", counter);

//make "HOME" work
sceKernelSleepThread();

//return your stuff
return 0;
}
[/highlight]

any help on what i did wrong? from what i see it should work. :huh:
 

Roe

Well-Known Member
Maybe if you actually look and read the errors the compiler gives you you'll get it...
Code:
1 error: '$pad' undeclared
This is telling you that $pad is undeclared. It's quite obvious that it's a typo and should be '&' not '$'
Code:
too many arguments for format
Again, a "typo". it should be '%i' and not '$i'.
Code:
expected ';' before ')'
You've got commas instead of semi-colons in your for statement...
Code:
implicit declaration of function 'sceDisplaywaitVblankStart'
Another spelling error. it's sceDisplayWaitVblankStart, not sceDisplaywaitVblankStart
 

pcstalljr

teen! hide your daughters
thanks alot! build went fine. im used to programing in visual studio >.< got to start looking out for the little things. but again. thanks :)
 

Cryox

Bro.
i am going to try that site out. never knew there was a site specifically for psp programming :D
 

Hardrive

Contributor
If those errors baffled you, you should step away, FAR away from development on the PSP. Find yourself a decent book, and learn text-only coding on the PC. You'll learn faster, you'll learn better coding habits, and you won't be a script kiddie.
 

pcstalljr

teen! hide your daughters
If those errors baffled you, you should step away, FAR away from development on the PSP. Find yourself a decent book, and learn text-only coding on the PC. You'll learn faster, you'll learn better coding habits, and you won't be a script kiddie.

lol hey. alittttle harsh but yeah. it just doesnt help when im trying to learn after a 14 hour shift at work :closedeyes:

its just that for some odd reason i thought it was more complicated then it was. so i seemed to over look the small details. thats all
 

Hardrive

Contributor
It's not a little harsh. Believe me, people can be way harsher to script kiddies ;)

Do you know good C/C++ practices? Can you use pointers and references? From your errors, it seems like you can't. Check out a book from your library, find an ebook, do something, and give yourself a proper C/C++ background. You'll thank me for it later (I accept cash :p).
 

pcstalljr

teen! hide your daughters
It's not a little harsh. Believe me, people can be way harsher to script kiddies ;)

Do you know good C/C++ practices? Can you use pointers and references? From your errors, it seems like you can't. Check out a book from your library, find an ebook, do something, and give yourself a proper C/C++ background. You'll thank me for it later (I accept cash :p).

:p ive been programing for the past 5 years. i just always seem to stumble on a new langauge, or device. lol the easest way i have found to learn it. is to get some basics of it. like here, then get alittle used to it. then dive into the include files. see how it works. what it need to work. if theres more ways to do it. i was just beyond tierd that day haha. and the little stuff slipped by
 

MiKeY188

S For So Not Mature
:p ive been programing for the past 5 years. i just always seem to stumble on a new langauge, or device. lol the easest way i have found to learn it. is to get some basics of it. like here, then get alittle used to it. then dive into the include files. see how it works. what it need to work. if theres more ways to do it. i was just beyond tierd that day haha. and the little stuff slipped by

5 years and you oculdnt fix them errors? wow
 

Moca

New Member
:p ive been programing for the past 5 years. i just always seem to stumble on a new langauge, or device. lol the easest way i have found to learn it. is to get some basics of it. ... and the little stuff slipped by

Understanding basics is an important part of learning a language, but you need more that "getting some basics of it" to be able to use C.

In addition to that, you need to know how to read compiler errors. In this case, your compiler actually told you what the "little stuff" that you let slip by was and where to find them.
 

HEN-A

Contributer
It's not a little harsh. Believe me, people can be way harsher to script kiddies ;)

Do you know good C/C++ practices? Can you use pointers and references? From your errors, it seems like you can't. Check out a book from your library, find an ebook, do something, and give yourself a proper C/C++ background. You'll thank me for it later (I accept cash :p).

Believe me im no Pro programmer(VB person :sleep:) but it is very easy to over look small things like that even if it looks clear as crystal on the screen what is wrong.

But I would like to get good at VB first then move on to C++.
 

Roe

Well-Known Member
It's not very easy to overlook, in fact, it's impossible unless you can't read, which in IMPOSSIBLE because if you couldn't read you couldn't program. The errors and warnings were spat out by the compiler which made it impossible to overlook.

NOT POSSIBLE :D
 

pcstalljr

teen! hide your daughters
this thread is of no use now. it is just random programmers complaining because i was stupid and trying to start out psp development after being awake for over 30 hours and being dyslexic doesn't help. and if i was simply patient i could have gotten some sleep and fixed them in the morning. so far the only supportive post is from HEN-A.

so, thank you HEN-A for the support. and i probably will be switching to VB if its easyer to learn. because i should have clarified when i said i was programing for 5 years. i was programing in SH and PERL on ubuntu. C on the other hand, is new to me.

so please, if you dont have anything useful or helpful or supportive to post. please dont post. its rather annoying to be almost attacked for asking for help.
 

yaustar

New Member
*Seriously resisting the urge to comment on the code in your signature*

If you do want to carry on learning C or C++, then don't make the PSP your target platform. Work on it for the PC and start slow.

Try working through the following guideline: Where to start C++ Programming Parabellum Games
 

Hardrive

Contributor
this thread is of no use now. it is just random programmers complaining because i was stupid and trying to start out psp development after being awake for over 30 hours and being dyslexic doesn't help. and if i was simply patient i could have gotten some sleep and fixed them in the morning. so far the only supportive post is from HEN-A.

so, thank you HEN-A for the support. and i probably will be switching to VB if its easyer to learn. because i should have clarified when i said i was programing for 5 years. i was programing in SH and PERL on ubuntu. C on the other hand, is new to me.

so please, if you dont have anything useful or helpful or supportive to post. please dont post. its rather annoying to be almost attacked for asking for help.
Have you even read the thread? First off, roe-ur-boat answered your question. Where's his credit?

Yaustar and I provided constructive suggestions on how to learn C/C++ faster. You're acting like that's a bad thing.

And don't you mean bash, not sh? ;)
 

pcstalljr

teen! hide your daughters
roe-ur-boat's credit is at the post after his. and i said supportive. not helpful. each post was helpful. just in an unexpected way if that makes sence haha. i was simply stating that it was rather annoying to be criticized for over looking a small error. thats not something i normally do haha. the code just got the best of me.

(and as you see from the times posted. most of my posts are extreamly late at night(5 am) except for my days off. (today) because thats most of the time that i get to code. so i apologize if my posts are thought out clearly)
 
Top