Undeclared Error
Undeclared Error
When I try to compile /samples/controller/basic/main.c This is the o/p I get...
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -02 -G0 -Wall -c -o main.o main.c
main.c: In function 'main':
main.c:69: error: 'SceCtrlData' undeclared (first use in this function)
main.c:69: error: (Each undeclared identifier is reported only once
main.c:69: error: for each fucntion it appeas in.)
main.c:69: error: parse error before 'pad'
main.c:75: error: 'PSP_CTRL_MODE_ANALOG' undeclared (first use in this funciton)
main.c:80: error: 'pad' undeclared (first use in this function)
main.c:86: error: 'PSP_CTRL_SQUARE' undeclared (first use in this function)
...
...
...
same err as line 86 for all the other first time uses of the corresponding PSP_CTRL_FUNC
...
...
...
make: *** [main.o] Error 1
I have followed this guide: http://forums.ps2dev.org/viewtopic.php? ... 80c8432b8f
I skipped number 7 as I did not bother with doxygen-doc...
I was successful to make the sdktest..no errors and got a working eboot.
Any information you have for me to solving this problem would be much appreciated...
Thanks in advance
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -02 -G0 -Wall -c -o main.o main.c
main.c: In function 'main':
main.c:69: error: 'SceCtrlData' undeclared (first use in this function)
main.c:69: error: (Each undeclared identifier is reported only once
main.c:69: error: for each fucntion it appeas in.)
main.c:69: error: parse error before 'pad'
main.c:75: error: 'PSP_CTRL_MODE_ANALOG' undeclared (first use in this funciton)
main.c:80: error: 'pad' undeclared (first use in this function)
main.c:86: error: 'PSP_CTRL_SQUARE' undeclared (first use in this function)
...
...
...
same err as line 86 for all the other first time uses of the corresponding PSP_CTRL_FUNC
...
...
...
make: *** [main.o] Error 1
I have followed this guide: http://forums.ps2dev.org/viewtopic.php? ... 80c8432b8f
I skipped number 7 as I did not bother with doxygen-doc...
I was successful to make the sdktest..no errors and got a working eboot.
Any information you have for me to solving this problem would be much appreciated...
Thanks in advance
last night I did a full SVN update.
And I did everything listed there. However my cygwin has got everything. Every possible option was selected. So you maybe missing parts that is required to run. Maybe update your installation?
Though to be honest I didn't try to complie anything particuarly afterwards...
And I did everything listed there. However my cygwin has got everything. Every possible option was selected. So you maybe missing parts that is required to run. Maybe update your installation?
Though to be honest I didn't try to complie anything particuarly afterwards...
Make the configure script executable:
Strange that it isn't already, though.
The 'underquoted definition' errors can generally be ignored safely.
Code: Select all
chmod a+x ./configure
The 'underquoted definition' errors can generally be ignored safely.
I've also found that when i had problems (after having added packages to cygwin), I removed cygwin and reinstalled with all required packages selected from the start, and that seemed to have fixed it. If you don't get anywhere, then I'd recommend that (reinstall, select DEV package, make sure you have all necessary packages gcc, wget, svn, autoconf, automake, etc).
I solve the problem by declare some useless varible to prevent undefined reference. And I found a page about cross gcc which talk about this problem , but I dont know what they say. May be this can help someone.
from http://www.vmlinux.org/crash/mirror/www ... FAQ-5.html
5.4 Where are open, read, write, close, etc. ?
The following is a typical situation people run into when linking their application.
--------------------------------------------------------------------------------
/usr/local/m68k-coff/lib/libc.a(sbrkr.o): In function `_sbrk_r':
sbrkr.c:60: undefined reference to `sbrk'
/usr/local/m68k-coff/lib/libc.a(makebuf.o): In function `__smakebuf':
makebuf.c:93: undefined reference to `isatty'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_open_r':
filer.c:63: undefined reference to `open'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_close_r':
filer.c:100: undefined reference to `close'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_lseek_r':
filer.c:142: undefined reference to `lseek'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_read_r':
filer.c:184: undefined reference to `read'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_write_r':
filer.c:226: undefined reference to `write'
/usr/local/m68k-coff/lib/libc.a(fstatr.o): In function `_fstat_r':
fstatr.c:61: undefined reference to `fstat'
--------------------------------------------------------------------------------
Depending upon the target, system calls are not built into newlib's libc.a. They are too dependent upon the particular target board in use. Libgloss (which comes with newlib net releases) is intended to be the repository of such routines and may either provide them in another library that you must link against or in an object file. For systems that don't have a need for such routines, just stub them out. e.g.
--------------------------------------------------------------------------------
int open (char *f, int flags, ...) { errno = ENOSYS; return -1; }
--------------------------------------------------------------------------------
etc.
from http://www.vmlinux.org/crash/mirror/www ... FAQ-5.html
5.4 Where are open, read, write, close, etc. ?
The following is a typical situation people run into when linking their application.
--------------------------------------------------------------------------------
/usr/local/m68k-coff/lib/libc.a(sbrkr.o): In function `_sbrk_r':
sbrkr.c:60: undefined reference to `sbrk'
/usr/local/m68k-coff/lib/libc.a(makebuf.o): In function `__smakebuf':
makebuf.c:93: undefined reference to `isatty'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_open_r':
filer.c:63: undefined reference to `open'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_close_r':
filer.c:100: undefined reference to `close'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_lseek_r':
filer.c:142: undefined reference to `lseek'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_read_r':
filer.c:184: undefined reference to `read'
/usr/local/m68k-coff/lib/libc.a(filer.o): In function `_write_r':
filer.c:226: undefined reference to `write'
/usr/local/m68k-coff/lib/libc.a(fstatr.o): In function `_fstat_r':
fstatr.c:61: undefined reference to `fstat'
--------------------------------------------------------------------------------
Depending upon the target, system calls are not built into newlib's libc.a. They are too dependent upon the particular target board in use. Libgloss (which comes with newlib net releases) is intended to be the repository of such routines and may either provide them in another library that you must link against or in an object file. For systems that don't have a need for such routines, just stub them out. e.g.
--------------------------------------------------------------------------------
int open (char *f, int flags, ...) { errno = ENOSYS; return -1; }
--------------------------------------------------------------------------------
etc.
laichung wrote:I use the latest toolchain but I still have the problem like upstair. It that because I using c++ do programming and use psp_g++ for compiling program?
mrbrown wrote:Update your toolchain.