Problem with 'Hello World'

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

Moderators: cheriff, TyRaNiD

Post Reply
pacman2323
Posts: 13
Joined: Mon Jul 03, 2006 5:20 pm

Problem with 'Hello World'

Post by pacman2323 »

Ok, I'm following this tutorial: http://www.psp-programming.com/tutorials/c/lesson02.htm

And I've gotten all the way to here-
"Now open up a CYGWIN Bash Shell and "cd" into your "projects/helloworld" directory. Type "make" and your shell should output some stuff to you. It will tell you if your source code had any errors that made it uncompilable. Generally, if it gives you a few warnings, it's not a big deal. Errors are what you want to watch out for, warnings are just possible points that could cause bugs. Note: if you have Firmware Version 1.50, you can automatically generate your two folders by typing "make kxploit" instead of "make.""

But when I do that I get this-
make: *** No rule to make target 'main.o', needed by 'hello.elf'. Stop.

What went wrong?
User avatar
groepaz
Posts: 305
Joined: Thu Sep 01, 2005 7:44 am
Contact:

Post by groepaz »

ask the one who wrote that tutorial and/or the makefile for that helloworld. he screwed it up :=)
pacman2323
Posts: 13
Joined: Mon Jul 03, 2006 5:20 pm

Post by pacman2323 »

What did he screw up?
pacman2323
Posts: 13
Joined: Mon Jul 03, 2006 5:20 pm

Post by pacman2323 »

Oops, I mispelled the filename. My bad. I noticed it made 'hello' and 'hello%' to put on the PSP, but it also made 'hello.elf', 'main.o' and 'PARAM.SFO'. What do I do with those?
pacman2323
Posts: 13
Joined: Mon Jul 03, 2006 5:20 pm

Post by pacman2323 »

Got a problem with Lesson 3 though:

here's my code-

Code: Select all

// Counter Program - My Second App for the PSP

/*
          This program was created by Pac Man on July 3, 2006.
          It is a simple Counter Program.
*/

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>

PSP_MODULE_INFO&#40;"Counter Program", 0, 1, 1&#41;;

#define printf pspDebugScreenPrintf

/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41; &#123;
          sceKernelExitGame&#40;&#41;;
          return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41; &#123;
          int cbid;

          cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
          sceKernelRegisterExitCallback&#40;cbid&#41;;

          sceKernelSleepThreadCB&#40;&#41;;

          return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41; &#123;
          int thid = 0;

          thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
          if&#40;thid >= 0&#41; &#123;
                    sceKernelStartThread&#40;thid, 0, 0&#41;;
          &#125;

          return thid;
&#125;

int main&#40;&#41; &#123;
    pspDebugScreenInit&#40;&#41;;
    SetupCallbacks&#40;&#41;;
    int counter = 0;
    int i = 0;
    SceCtrlData pad;
    printf&#40;"Press &#91;X&#93; To Start the Timer"&#41;;
    sceKernelSleepThread&#40;&#41;;
    return 0;
    &#125;
while&#40;1&#41; &#123;
         sceCtrlReadBufferPositive&#40;&pad, 1&#41;; 
         if&#40;pad.Buttons & PSP_CTRL_CROSS&#41; &#123;
                        break;
         &#125;
&#125;
while&#40;1&#41; &#123;
          sceCtrlReadBufferPositive&#40;&pad, 1&#41;;
          if&#40;pad.Buttons & PSP_CTRL_CIRCLE&#41; &#123;
                    break;
          &#125;
    pspDebugScreenClear&#40;&#41;;
    printf&#40;"Press &#91;O&#93; To Stop the Timer\n"&#41;;
    printf&#40;"Counter&#58; %i", counter&#41;;
    counter++;
    for&#40;i=0; i<5; i++&#41; &#123;
             sceDisplayWaitVblankStart&#40;&#41;;
    &#125;
&#125;
pspDebugScreenClear&#40;&#41;;
printf&#40;"Counter Finished."&#41;;
printf&#40;"Final Count&#58; %i", counter&#41;;
And here's the error I'm getting-

Image
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

The link at the top of the page where that tutorial was found leads to their own forums:

http://www.psp-programming.com/dev-forum/

Perhaps you'll find better support there?
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

all after this is outside main function so code is
incorrect

Code: Select all

return 0;
    &#125;
while&#40;1&#41; &#123;
         sceCtrlReadBufferPositive&#40;&pad, 1&#41;; 
10011011 00101010 11010111 10001001 10111010
pacman2323
Posts: 13
Joined: Mon Jul 03, 2006 5:20 pm

Post by pacman2323 »

So how would I rewrite it?
User avatar
groepaz
Posts: 305
Joined: Thu Sep 01, 2005 7:44 am
Contact:

Post by groepaz »

what oopo said, those ppl should know a lot better, since they made that stuff :)
Post Reply