 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
ansem227
Joined: 13 Mar 2006 Posts: 1
|
Posted: Mon Mar 13, 2006 7:29 am Post subject: Idk what happened |
|
|
ok im a new at programming
but im only 14 years old
and ive been looking at this forum for a bit now and
i final have a problem and i hope someone can help me
but i tried to make my program with cygwin and it worked b4 and then i tryed to make it agian and this happened
| Code: | Mine@mine /projects/helloworld2
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -c -o main.o mai
n.c
main.c: In function 'main':
main.c:63: warning: unused variable 't'
main.c:62: warning: unused variable 'g'
main.c:61: warning: unused variable 'i'
main.c:58: warning: unused variable 'pad'
main.c: At top level:
main.c:67: error: syntax error before string constant
main.c:67: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin
tf'
main.c:67: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:67: warning: data definition has no type or storage class
main.c:68: error: syntax error before string constant
main.c:68: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin
tf'
main.c:68: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:68: warning: data definition has no type or storage class
main.c:69: error: syntax error before string constant
main.c:69: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin
tf'
main.c:69: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:69: warning: data definition has no type or storage class
main.c:70: error: syntax error before string constant
main.c:70: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin
tf'
main.c:70: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:70: warning: data definition has no type or storage class
main.c:71: error: syntax error before string constant
main.c:71: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin
tf'
main.c:71: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:71: warning: data definition has no type or storage class
main.c:79: error: syntax error before string constant
main.c:79: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin
tf'
main.c:79: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:79: warning: data definition has no type or storage class
main.c:85: warning: type defaults to 'int' in declaration of 'pspDebugScreenClea
r'
main.c:85: error: conflicting types for 'pspDebugScreenClear'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:96: error: previous declaration of
'pspDebugScreenClear' was here
main.c:85: warning: data definition has no type or storage class
main.c:86: error: syntax error before '+=' token
main.c:93: error: syntax error before string constant
main.c:93: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin
tf'
main.c:93: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:93: warning: data definition has no type or storage class
main.c:94: error: syntax error before string constant
main.c:94: warning: type defaults to 'int' in declaration of 'pspDebugScreenPrin
tf'
main.c:94: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:94: warning: data definition has no type or storage class
main.c:101: warning: type defaults to 'int' in declaration of 'pspDebugScreenCle
ar'
main.c:101: error: conflicting types for 'pspDebugScreenClear'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:96: error: previous declaration of
'pspDebugScreenClear' was here
main.c:101: warning: data definition has no type or storage class
main.c:102: error: syntax error before string constant
main.c:102: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:102: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:102: warning: data definition has no type or storage class
main.c:103: error: syntax error before string constant
main.c:103: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:103: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:103: warning: data definition has no type or storage class
main.c:104: error: syntax error before string constant
main.c:104: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:104: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:104: warning: data definition has no type or storage class
main.c:113: warning: type defaults to 'int' in declaration of 'pspDebugScreenCle
ar'
main.c:113: error: conflicting types for 'pspDebugScreenClear'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:96: error: previous declaration of
'pspDebugScreenClear' was here
main.c:113: warning: data definition has no type or storage class
main.c:114: error: syntax error before string constant
main.c:114: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:114: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:114: warning: data definition has no type or storage class
main.c:115: error: syntax error before string constant
main.c:115: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:115: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:115: warning: data definition has no type or storage class
main.c:116: error: syntax error before string constant
main.c:116: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:116: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:116: warning: data definition has no type or storage class
main.c:138: error: syntax error before string constant
main.c:138: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:138: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:138: warning: data definition has no type or storage class
main.c:139: error: syntax error before '+=' token
main.c:145: error: syntax error before string constant
main.c:145: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:145: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:145: warning: data definition has no type or storage class
main.c:146: error: syntax error before '+=' token
main.c:154: error: syntax error before string constant
main.c:154: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:154: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:154: warning: data definition has no type or storage class
main.c:155: error: syntax error before string constant
main.c:155: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:155: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:155: warning: data definition has no type or storage class
main.c:156: error: syntax error before string constant
main.c:156: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:156: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:156: warning: data definition has no type or storage class
main.c:157: error: syntax error before string constant
main.c:157: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:157: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:157: warning: data definition has no type or storage class
main.c:158: error: syntax error before string constant
main.c:158: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:158: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:158: warning: data definition has no type or storage class
main.c:159: error: syntax error before string constant
main.c:159: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:159: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:159: warning: data definition has no type or storage class
main.c:160: error: syntax error before string constant
main.c:160: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:160: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:160: warning: data definition has no type or storage class
main.c:161: error: syntax error before string constant
main.c:161: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:161: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:161: warning: data definition has no type or storage class
main.c:162: error: syntax error before string constant
main.c:162: warning: type defaults to 'int' in declaration of 'pspDebugScreenPri
ntf'
main.c:162: error: conflicting types for 'pspDebugScreenPrintf'
/usr/local/pspdev/psp/sdk/include/pspdebug.h:40: error: previous declaration of
'pspDebugScreenPrintf' was here
main.c:162: warning: data definition has no type or storage class
make: *** [main.o] Error 1
|
and my code is
| Code: |
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#define printf pspDebugScreenPrintf
#define N 100
PSP_MODULE_INFO("The Guessing Game", 0, 1, 1);
/* 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() {
SceCtrlData pad;
pspDebugScreenInit();
SetupCallbacks();
int i = 1;
int g = 1;
int t = 1;
}
printf(" ___ _ _ ___ ___ ___ ___ ___ ___ ____ \n");
printf(" / _ \\ | \\| | | __| | __| | V | |_ | |_ | |__ | \n");
printf(" / /_\\ \\ | | |__ | | __| | |\\_/| | / /_ / /_ / / \n");
printf(" /_/ \\_\\ |_|\\_| |___| |___| |_| |_| |____| |____| /_/ \n");
printf("Press [X] To Make a Random Number\n");
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
break;
}
}
printf("Press [O] To Make a Random Number\n");
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE) {
break;
}
pspDebugScreenClear();
i += 1;
if (i > 500)
{
i = 1;
}
}
printf("Ok now for the game\n");
printf("guess a number (1-500)\n");
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons & PSP_CTRL_UP)
{
g += 1;
pspDebugScreenClear();
printf("Ok now for the game\n");
printf("guess a number (1-500)\n");
printf("%d\n",g);
if (g > 500)
{
g = 1;
}
}
if (pad.Buttons & PSP_CTRL_DOWN)
{
g -= 1;
pspDebugScreenClear();
printf("Ok now for the game\n");
printf("guess a number (1-500)\n");
printf("%d\n",g);
if (g < 1)
{
g = 500;
}
}
if (pad.Buttons & PSP_CTRL_CROSS)
{
if (g == i)
{
pspDebugScreenClear();
{
break;
}
}
if (g > i)
{
pspDebugScreenClear();
printf("Two High try agian");
t += 1;
}
if (g < i)
{
pspDebugScreenClear();
printf("Two Low try agian");
t += 1;
}
}
}
while (1) {
printf("W \n");
printf(" I \n");
printf(" N \n");
printf(" N \n");
printf(" E \n");
printf(" R\n");
printf(" \n");
printf(" \n");
printf("WINNER\n");
printf("In %d Tries\n",t);
}
}
|
and i no the code my be sloppy
and im sorry |
|
| Back to top |
|
 |
urchin
Joined: 02 Jun 2005 Posts: 121
|
Posted: Mon Mar 13, 2006 7:55 am Post subject: |
|
|
Look through the compiler messages for the first error (not warning). In this case:
| Code: |
main.c:67: error: syntax error before string constant
|
This gives you a clue that the first problem is in your main function. You have an extra "}" above the first printf which ends the function too early. |
|
| Back to top |
|
 |
sg57
Joined: 14 Oct 2005 Posts: 154
|
Posted: Mon Mar 13, 2006 11:02 am Post subject: |
|
|
You have quite alot of erros in there, almost all syntax when looking at it
Get Ultra Edit or Dev-C++ and click -> on the keyboard alot until you reacha '{' or '[' or '(' then scroll thro your code with your mouse and make sure the 2 'brackets' 'prenethesis' or '[ ]' match up with what thye bare supposed to, and if you see when on 'int main() {' the { highlight, then scroll down and see a nother one highlioghted half way through, thats saying you have an extra or added code after the 'main' rpgoram resulting in a complie error.
Look over your code right now, right after you declare your variables and 'initializex them' you closed your main program meaning your done, thats why your getting soooo many errors
And your 'int main() {' is has to return something, add a return 0; right before closing the main program.
OFF TOPIC: I too am 14 years old |
|
| Back to top |
|
 |
HaQue
Joined: 25 Nov 2005 Posts: 91 Location: Adelaide, Australia
|
Posted: Mon Mar 13, 2006 2:39 pm Post subject: |
|
|
If it helps, try some comments to help you.
comments:
| Code: |
int main() {
while(true) {
if (a < b) {
if (c == b) {
doAnotherThing();
} // ends if
doSomething();
} // ends if
} // ends while
} // ends main function
|
no comments
| Code: |
int main() {
while(true) {
if (a < b) {
if (c == b) {
doAnotherThing();
}
doSomething();
}
}
}
|
see the difference? It is SO easy to add too many barckets, especially in game programming where there are alot of conditional statements _________________ www.smartwave-wireless.com |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|