QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

Good tutorials for learning C?

This is a discussion on Good tutorials for learning C? within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I am new to C and installed Cygwin and psptoolchain today. I want to start learning about this and I ...

Reply
 
LinkBack Thread Tools
Old 08-07-2007, 09:27 PM   #1
 
Join Date: Aug 2007
Posts: 15
Trader Feedback: 0
Default Good tutorials for learning C?

I am new to C and installed Cygwin and psptoolchain today. I want to start learning about this and I thought the best way would be tutorials and examples. I was curious what the best site is for good tutorials that explain what is going on in the code and each step? I have checked out psp-programming.com a bit but seems like I always mess up when trying to compile the code I get some errors and I copy it straight from the page. Thanks.
DevTeam6 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:30 PM   #2
No longer a community member.
 
Join Date: Dec 2005
Posts: 22
Trader Feedback: 0
Default

Where to start C++ Programming « Parabellum Games

cplusplus.com - The C++ Resources Network

Cprogramming.com - Programming Tutorials: C++ Made Easy and C Made Easy
Hardrive is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:30 PM   #3
 
Join Date: Jul 2007
Posts: 296
Trader Feedback: 0
Default

Don't listen to anyone who gives you PSP programming tutorials. Go to http://cplusplus.com/ or http://cprogramming.com/ to learn everything you can about C. Then, you can go on to learn about the PSP specific libraries and APIs.
_dysfunctional is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:32 PM   #4
No longer a community member.
 
Join Date: Dec 2005
Posts: 22
Trader Feedback: 0
Default

PSPJunkie, you just got pwnt. (look above you)
Hardrive is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:33 PM   #5
 
Join Date: Jul 2007
Posts: 296
Trader Feedback: 0
Default

I know. :P But look at the times I was busy typing on IRC...
_dysfunctional is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:35 PM   #6
No longer a community member.
 
Join Date: Dec 2005
Posts: 22
Trader Feedback: 0
Default

I lol'd
Hardrive is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:37 PM   #7
 
Join Date: Jul 2007
Posts: 296
Trader Feedback: 0
Default

You got me... I surrender.

_dysfunctional is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:49 PM   #8
 
Join Date: Aug 2007
Posts: 15
Trader Feedback: 0
Default

Quote:
Originally Posted by Archaemic
My Cygwin dir is 1.71GB. But I've got other stuff in there, too.
Quote:
Originally Posted by eldiablov
around 150 - 200 mb. I think

I get this error:
Quote:
Owner@ryan-m5nmm4n0rg ~
$ cd C:/

Owner@ryan-m5nmm4n0rg /cygdrive/c
$ make kxploit
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=
150 -c -o main.o main.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=
150 -c -o graphics.o graphics.c
graphics.c:5:17: error: png.h: No such file or directory
graphics.c:51: error: expected ')' before 'png_ptr'
graphics.c: In function 'loadImage':
graphics.c:57: error: 'png_structp' undeclared (first use in this function)
graphics.c:57: error: (Each undeclared identifier is reported only once
graphics.c:57: error: for each function it appears in.)
graphics.c:57: error: expected ';' before 'png_ptr'
graphics.c:58: error: 'png_infop' undeclared (first use in this function)
graphics.c:58: error: expected ';' before 'info_ptr'
graphics.c:60: error: 'png_uint_32' undeclared (first use in this function)
graphics.c:60: error: expected ';' before 'width'
graphics.c:63: error: 'FILE' undeclared (first use in this function)
graphics.c:63: error: 'fp' undeclared (first use in this function)
graphics.c:67: warning: implicit declaration of function 'fopen'
graphics.c:68: error: 'png_ptr' undeclared (first use in this function)
graphics.c:68: warning: implicit declaration of function 'png_create_read_struct
'
graphics.c:68: error: 'PNG_LIBPNG_VER_STRING' undeclared (first use in this func
tion)
graphics.c:71: warning: implicit declaration of function 'fclose'
graphics.c:74: warning: implicit declaration of function 'png_set_error_fn'
graphics.c:74: error: 'png_voidp' undeclared (first use in this function)
graphics.c:74: error: 'png_error_ptr' undeclared (first use in this function)
graphics.c:74: error: 'user_warning_fn' undeclared (first use in this function)
graphics.c:75: error: 'info_ptr' undeclared (first use in this function)
graphics.c:75: warning: implicit declaration of function 'png_create_info_struct
'
graphics.c:79: warning: implicit declaration of function 'png_destroy_read_struc
t'
graphics.c:79: error: 'png_infopp_NULL' undeclared (first use in this function)
graphics.c:82: warning: implicit declaration of function 'png_init_io'
graphics.c:83: warning: implicit declaration of function 'png_set_sig_bytes'
graphics.c:84: warning: implicit declaration of function 'png_read_info'
graphics.c:85: warning: implicit declaration of function 'png_get_IHDR'
graphics.c:85: error: 'width' undeclared (first use in this function)
graphics.c:85: error: 'height' undeclared (first use in this function)
graphics.c:85: error: 'int_p_NULL' undeclared (first use in this function)
graphics.c:96: warning: implicit declaration of function 'png_set_strip_16'
graphics.c:97: warning: implicit declaration of function 'png_set_packing'
graphics.c:98: error: 'PNG_COLOR_TYPE_PALETTE' undeclared (first use in this fun
ction)
graphics.c:98: warning: implicit declaration of function 'png_set_palette_to_rgb
'
graphics.c:99: error: 'PNG_COLOR_TYPE_GRAY' undeclared (first use in this functi
on)
graphics.c:99: warning: implicit declaration of function 'png_set_gray_1_2_4_to_
8'
graphics.c:100: warning: implicit declaration of function 'png_get_valid'
graphics.c:100: error: 'PNG_INFO_tRNS' undeclared (first use in this function)
graphics.c:100: warning: implicit declaration of function 'png_set_tRNS_to_alpha
'
graphics.c:101: warning: implicit declaration of function 'png_set_filler'
graphics.c:101: error: 'PNG_FILLER_AFTER' undeclared (first use in this function
)
graphics.c:118: warning: implicit declaration of function 'png_read_row'
graphics.c:118: error: 'png_bytep_NULL' undeclared (first use in this function)
graphics.c:125: warning: implicit declaration of function 'png_read_end'
graphics.c: In function 'createImage':
graphics.c:216: warning: implicit declaration of function 'memset'
graphics.c:216: warning: incompatible implicit declaration of built-in function
'memset'
graphics.c: In function 'printTextScreen':
graphics.c:296: warning: implicit declaration of function 'strlen'
graphics.c:296: warning: incompatible implicit declaration of built-in function
'strlen'
graphics.c: In function 'printTextImage':
graphics.c:323: warning: incompatible implicit declaration of built-in function
'strlen'
graphics.c: In function 'saveImage':
graphics.c:343: error: 'png_structp' undeclared (first use in this function)
graphics.c:343: error: expected ';' before 'png_ptr'
graphics.c:344: error: 'png_infop' undeclared (first use in this function)
graphics.c:344: error: expected ';' before 'info_ptr'
graphics.c:345: error: 'FILE' undeclared (first use in this function)
graphics.c:345: error: 'fp' undeclared (first use in this function)
graphics.c:350: error: 'png_ptr' undeclared (first use in this function)
graphics.c:350: warning: implicit declaration of function 'png_create_write_stru
ct'
graphics.c:350: error: 'PNG_LIBPNG_VER_STRING' undeclared (first use in this fun
ction)
graphics.c:352: error: 'info_ptr' undeclared (first use in this function)
graphics.c:354: warning: implicit declaration of function 'png_destroy_write_str
uct'
graphics.c:354: error: 'png_infopp' undeclared (first use in this function)
graphics.c:358: warning: implicit declaration of function 'png_set_IHDR'
graphics.c:359: error: 'PNG_COLOR_TYPE_RGBA' undeclared (first use in this funct
ion)
graphics.c:359: error: 'PNG_COLOR_TYPE_RGB' undeclared (first use in this functi
on)
graphics.c error: 'PNG_INTERLACE_NONE' undeclared (first use in this functi
on)
graphics.c error: 'PNG_COMPRESSION_TYPE_DEF AULT' undeclared (first use in t
his function)
graphics.c error: 'PNG_FILTER_TYPE_DEFAULT' undeclared (first use in this f
unction)
graphics.c:361: warning: implicit declaration of function 'png_write_info'
graphics.c:375: warning: implicit declaration of function 'png_write_row'
graphics.c:378: warning: implicit declaration of function 'png_write_end'
make: *** [graphics.o] Error 1

Owner@ryan-m5nmm4n0rg /cygdrive/c
$
When I try to do Lesson 5 at psp-programming, and I did it all correctly from the start. I started with a new main.c and everything.

My code was:

Quote:
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <stdio.h>
#include <psppower.h>

#include "graphics.h"

PSP_MODULE_INFO("Backgrou nd Changer", 0, 1, 1);

#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))

/* 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);
sceKernelRegisterExitCall back(cbid);

sceKernelSleepThreadCB();

return 0;
}

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

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

return thid;
}

int main(void) {
scePowerSetClockFrequency (333, 333, 166);
SetupCallbacks();
initGraphics();
SceCtrlData pad;
int i;
int selComponent = 0;
char filler[10];
int bgR = 0;
int bgG = 0;
int bgB = 0;
Color highlightColor = RGB(200, 200, 200);
Color dimmedColor = RGB(100, 100, 100);
Color shadowColorH = RGB(55, 55, 55 );
Color shadowColorD = RGB(55, 55, 55 );

while(1) {
sceCtrlReadBufferPositive (&pad, 1);

if(pad.Buttons & PSP_CTRL_UP) {
if(selComponent > 0) {
selComponent--;
}
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart ();
}
} else if(pad.Buttons & PSP_CTRL_DOWN) {
if(selComponent < 2) {
selComponent++;
}
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart ();
}

}
if(pad.Buttons & PSP_CTRL_RIGHT) {
switch(selComponent) {
case 0:
bgR++;
break;
case 1:
bgG++;
break;
case 2:
bgB++;
break;
default:
//SHOULD NEVER EXECUTE
break;
}

} else if(pad.Buttons & PSP_CTRL_LEFT) {
switch(selComponent) {
case 0:
bgR--;
break;
case 1:
bgG--;
break;
case 2:
bgB--;
break;
default:
//SHOULD NEVER EXECUTE
break;
}
}

if(bgR < 0) {
bgR = 0;
} else if(bgR > 255) {
bgR = 255;
}
if(bgG < 0) {
bgG = 0;
} else if(bgG > 255) {
bgG = 255;
}
if(bgB < 0) {
bgB = 0;
} else if(bgB > 255) {
bgB = 255;
}
fillScreenRect(RGB(bgR, bgG, bgB), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
sprintf(filler, " RED: %i", bgR);
if(selComponent == 0) {
printTextScreen(11, 10, filler, shadowColorH);
printTextScreen(10, 10, filler, highlightColor);
} else {
printTextScreen(11, 10, filler, shadowColorD);
printTextScreen(10, 10, filler, dimmedColor);
}
sprintf(filler, "GREEN: %i", bgG);
if(selComponent == 1) {
printTextScreen(11, 20, filler, shadowColorH);
printTextScreen(10, 20, filler, highlightColor);
} else {
printTextScreen(11, 20, filler, shadowColorD);
printTextScreen(10, 20, filler, dimmedColor);
}

sprintf(filler, " BLUE: %i", bgB);
if(selComponent == 2) {
printTextScreen(11, 30, filler, shadowColorH);
printTextScreen(10, 30, filler, highlightColor);
} else {
printTextScreen(11, 30, filler, shadowColorD);
printTextScreen(10, 30, filler, dimmedColor);
}

flipScreen();

for(i=0; i<1; i++) {
sceDisplayWaitVblankStart ();
}
}

return 0;
}

But I will check out those sites that you guys gave me. I was hoping to learn of some other sites that were centered around the PSP as well so I can also test some of the stuff on my psp after I learned about it and everything.
DevTeam6 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:51 PM   #9
 
Join Date: Jul 2007
Posts: 296
Trader Feedback: 0
Default

Well, you didn't install libpng.

Code:
svn co svn://svn.ps2dev.org/psp/trunk/libpng
cd libpng
make
make install
_dysfunctional is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 09:52 PM   #10
No longer a community member.
 
Join Date: Dec 2005
Posts: 22
Trader Feedback: 0
Default

PSP-programming.com is obviously PSP centered.

Nobody on the other sites is going to be able to help you with PSP programming though.
Hardrive is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-07-2007, 11:30 PM   #11
 
Join Date: Aug 2007
Posts: 15
Trader Feedback: 0
Default

Quote:
Originally Posted by _dysfunctional
Well, you didn't install libpng.

Code:
svn co svn://svn.ps2dev.org/psp/trunk/libpng
cd libpng
make
make install
Thanks I have been getting a lot of errors so I hope this works, you sure it will?
DevTeam6 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 01:51 AM   #12
 
myschoo's Avatar
 
Join Date: Jul 2006
Location: Middle Europe
Posts: 1,281
Trader Feedback: 0
Default

yeah it looks like it... (lot of errors from graphics.c)
__________________
[CENTER][SIZE="1"][1 Year QJ Member]
[COLOR="Sienna"][LUA Coder and C Learner][/COLOR]
[URL="http://dl.qj.net/Ball-Revamped-Clone-v.1-PSP-Homebrew-Games/pg/12/fid/15231/catid/195"] [COLOR="SlateGray"][Ball Revamped Clone v0.1][/COLOR] [/URL]
[URL="http://dl.qj.net/Phil-s-Shooting-Range-v0.3-PSP-Homebrew-Games/pg/12/fid/11542/catid/194"] [COLOR="SlateGray"][Phil's Shooting Range v0.3][/COLOR] [/URL]
[URL="http://dl.qj.net/Organization-Apps/pg/12/fid/14248/catid/190"][COLOR="SlateGray"][HideFile PRX v2][/COLOR][/URL]
[URL="http://dl.qj.net/SSR-PRX-v1.1-PSP-Homebrew-Applications/pg/12/fid/14725/catid/151"][COLOR="SlateGray"][SSR PRX v1.1][/COLOR][/URL] [/SIZE][/CENTER]
myschoo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 02:04 AM   #13
 
brethren's Avatar
 
Join Date: Apr 2007
Posts: 464
Trader Feedback: 0
Default

Quote:
Originally Posted by _dysfunctional
Well, you didn't install libpng.

Code:
svn co svn://svn.ps2dev.org/psp/trunk/libpng
cd libpng
make
make install
it won't work. if he hasn't installed libpng then he more than likely hasn't installed zlib

@devteam you'll need to download and install zlib before libpng

svn checkout svn://svn.ps2dev.org/psp/trunk/zlib

then just follow the readme
brethren is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 02:12 AM   #14
 
Join Date: Aug 2007
Posts: 15
Trader Feedback: 0
Default

Is there a place or something that tells me everything I need to install? I do not want to get errors and think it is on my part since I am missing one of these downlaods so is there some place that tells me everything I need? I just downloading cygwin and psptoolchain today.

Edit: I never really have learned C. And I was curious is the PSP a good place to start learning C and testing programs on?
DevTeam6 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 02:21 AM   #15
 
myschoo's Avatar
 
Join Date: Jul 2006
Location: Middle Europe
Posts: 1,281
Trader Feedback: 0
Default

on psp-programming.com there is tutorial for pictures... (.png) and also it tells you what to install
__________________
[CENTER][SIZE="1"][1 Year QJ Member]
[COLOR="Sienna"][LUA Coder and C Learner][/COLOR]
[URL="http://dl.qj.net/Ball-Revamped-Clone-v.1-PSP-Homebrew-Games/pg/12/fid/15231/catid/195"] [COLOR="SlateGray"][Ball Revamped Clone v0.1][/COLOR] [/URL]
[URL="http://dl.qj.net/Phil-s-Shooting-Range-v0.3-PSP-Homebrew-Games/pg/12/fid/11542/catid/194"] [COLOR="SlateGray"][Phil's Shooting Range v0.3][/COLOR] [/URL]
[URL="http://dl.qj.net/Organization-Apps/pg/12/fid/14248/catid/190"][COLOR="SlateGray"][HideFile PRX v2][/COLOR][/URL]
[URL="http://dl.qj.net/SSR-PRX-v1.1-PSP-Homebrew-Applications/pg/12/fid/14725/catid/151"][COLOR="SlateGray"][SSR PRX v1.1][/COLOR][/URL] [/SIZE][/CENTER]
myschoo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 03:46 AM   #16
Banned for LIFE
 
Join Date: Oct 2006
Location: East London, England
Posts: 2
Trader Feedback: 0
Default

Quote:
Originally Posted by DevTeam6
Is there a place or something that tells me everything I need to install? I do not want to get errors and think it is on my part since I am missing one of these downlaods so is there some place that tells me everything I need? I just downloading cygwin and psptoolchain today.

Edit: I never really have learned C. And I was curious is the PSP a good place to start learning C and testing programs on?
psp-programming lol
eldiablov is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 04:08 AM   #17

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

Quote:
Originally Posted by DevTeam6
Edit: I never really have learned C. And I was curious is the PSP a good place to start learning C and testing programs on?
No. Look at Hardrive's first post.
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 06:46 AM   #18
No longer a community member.
 
Join Date: Dec 2005
Posts: 22
Trader Feedback: 0
Default

Quote:
Originally Posted by yaustar
No. Look at Hardrive's first post.
LOL, that was a pretty good plug to your blog, wasn't it
Hardrive is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 06:57 AM   #19

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

Quote:
Originally Posted by Hardrive
LOL, that was a pretty good plug to your blog, wasn't it
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 08:53 AM   #20
 
Join Date: Aug 2007
Posts: 15
Trader Feedback: 0
Default

Thank you everyone! I guess I already install zlib but must have missed libpng. I installed both and the errors went completely away, awesome.
DevTeam6 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
good , learning , tutorials

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 01:04 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us