Setting up Dev-C++ with PSPSDK

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

Moderators: cheriff, TyRaNiD

Twenty 2
Posts: 15
Joined: Mon Jul 25, 2005 3:23 am

Post by Twenty 2 »

[Linker error] undefined reference to `sceKernelCreateThread'
[Linker error] undefined reference to `sceKernelStartThread'
[Linker error] undefined reference to `main'
y:\drive\c\Program Files\PSPDev\psp\lib\crt0.o In function `__entrytable':
[Linker error] undefined reference to `module_info'
y:\drive\c\Program Files\PSPDev\psp\lib\crt0.o ld returned 1 exit status
C:\Dev-Cpp\Makefile.win [Build Error] [Project2.exe] Error 1

i keep getting the same errors when i try to compile sources of already made psp hombrew.Could any one help?
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

Twenty 2 wrote:[Linker error] undefined reference to `sceKernelCreateThread'
[Linker error] undefined reference to `sceKernelStartThread'
[Linker error] undefined reference to `main'
y:\drive\c\Program Files\PSPDev\psp\lib\crt0.o In function `__entrytable':
[Linker error] undefined reference to `module_info'
y:\drive\c\Program Files\PSPDev\psp\lib\crt0.o ld returned 1 exit status
C:\Dev-Cpp\Makefile.win [Build Error] [Project2.exe] Error 1

i keep getting the same errors when i try to compile sources of already made psp hombrew.Could any one help?
Please read the common errors and solutions page, it has your answer.
Lego of my Ago!
Twenty 2
Posts: 15
Joined: Mon Jul 25, 2005 3:23 am

Post by Twenty 2 »

ya im a newb to this so i dont exactly know what to look for
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

Please, use the search function. It is your friend. Just because you are new to developing applications on the PSP doesn't mean that you have the right to not do any work yourself.

Here, I did your work for you and linked the thread. Read THIS thread.
Lego of my Ago!
Twenty 2
Posts: 15
Joined: Mon Jul 25, 2005 3:23 am

Post by Twenty 2 »

Sorry i knew where the thread was i just didnt know which would answer my question...
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

If you look at your code, you will see that you have:
Twenty 2 wrote: y:\drive\c\Program Files\PSPDev\psp\lib\crt0.o In function `__entrytable':
[Linker error] undefined reference to `module_info'
y:\drive\c\Program Files\PSPDev\psp\lib\crt0.o ld returned 1 exit status
C:\Dev-Cpp\Makefile.win [Build Error] [Project2.exe] Error 1
Does that not look similar to:
Common errors and Solutions wrote:Q: In function `__entrytable':
crt0.S:(.rodata.sceResident+0xc): undefined reference to `module_info'
A:Make sure that you have PSP_MODULE_INFO("SOMETHING", 0, 1, 1); somewhere in your program.
Lego of my Ago!
Twenty 2
Posts: 15
Joined: Mon Jul 25, 2005 3:23 am

Post by Twenty 2 »

wow.. im not a morning person lol but thnx man.
Mura
Posts: 2
Joined: Tue Aug 02, 2005 1:36 pm

Post by Mura »

sicksand wrote:i have no problem in setup the environment in dev cpp. but i have encountered error when compiling it. the output of error are.

Code: Select all

 C:\Dev-Cpp\project\Makefile [Build Error]  No rule to make target `main.o', needed by `project.elf'.  Stop. 
details :

my project.dev file is in Dev-Cpp folder, my project file, main.c and Makefile are in a directory named testpower

Code: Select all

-Dev-Cpp
 |_ project1.dev
 |_ testpower
    |_ main.c
    |_ Makefile
 |_devcpp.exe
thanks.[/code]
I got the same error ,please help

BTW,in console mode ,there was no error
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

Mura wrote:I got the same error ,please help

BTW,in console mode ,there was no error
Are you using a custom make file? or an auto-generated one?
Lego of my Ago!
Mura
Posts: 2
Joined: Tue Aug 02, 2005 1:36 pm

Post by Mura »

I know the problem now.

We should put the project file (*.dev) and the "makefile" in a same directory.

Thank you for your help :)

lol
Squall333
Posts: 91
Joined: Thu Apr 28, 2005 5:32 am

Post by Squall333 »

I keep getting

makefile:17: C:/pspdev/psp/sdk: Permission denied
makefile:17: /lib/build.mak: No such file or directory
make: *** No rule to make target `/lib/build.mak'. Stop.
XRS
Posts: 32
Joined: Sun May 15, 2005 7:09 pm

Post by XRS »

So i just need this to begin programming with c++ to PSP??
I have read some tutos that talk in install cygwin, psptoochain...

I am a little confused...
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

XRS wrote:So i just need this to begin programming with c++ to PSP??
I have read some tutos that talk in install cygwin, psptoochain...

I am a little confused...
The win32 package is outdated, and I have udpated the page to point to the programming FAQ wiki page.

After you read the wiki, then follow the rest of the directions in order to set it up.
Lego of my Ago!
XRS
Posts: 32
Joined: Sun May 15, 2005 7:09 pm

Post by XRS »

Oh, ok!
Thanks...i will read it!
maestun
Posts: 2
Joined: Thu Sep 01, 2005 9:07 pm

Post by maestun »

Hi all,

I've just downloaded the libpng and the zlib from the svn repository.
They compiled fine with Dev-C++, creating the libpng.a and zlib.a librairies. I've installed them into the $(PSPSDK)/lib dir.

Now I'd like to compile a piece of code taken from Shine's graphics.c file (from the LuaPlayer source), just to see if I can display a PNG picture on my PSP.

Compilation is okay, but I keep having the following linker errors :

Code: Select all

make.exe -f "Makefile" all
psp-gcc -I. -I/cygdrive/c/pdev/psp/psp/sdk/include -O2 -G0 -Wall  -L. -L/cygdrive/c/pdev/psp/psp/sdk/lib   main.o -lpng -lz -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspglue -lpspuser -lpspkernel -o hello.elf
/cygdrive/c/pdev/psp/psp/sdk/lib/libpng.a(pngrtran.o): In function `png_build_gamma_table':
pngrtran.c:(.text+0x1264): undefined reference to `pow'
pngrtran.c:(.text+0x147c): undefined reference to `pow'
pngrtran.c:(.text+0x1524): undefined reference to `pow'
pngrtran.c:(.text+0x163c): undefined reference to `pow'
pngrtran.c:(.text+0x1718): undefined reference to `pow'
/cygdrive/c/pdev/psp/psp/sdk/lib/libpng.a(pngrtran.o):pngrtran.c:(.text+0x1804): more undefined references to `pow' follow
/cygdrive/c/pdev/psp/psp/sdk/lib/libpspglue.a(_open.o): In function `__psp_init_cwd':
/cygdrive/c/cygwin/usr/local/pspdev/pspsdk/sdk/libc/libcglue.c:52: undefined reference to `strrchr'
collect2: ld returned 1 exit status
make: *** [hello.elf] Error 1
Is libpng recompiled each time ?
I tryed to search these forums, badly I guess, because I can't find an answer :/

By the way, here is my Makefile (I use a custom one from the SDK, not the one generated by Dev-C++) :

Code: Select all

TARGET = hello
OBJS = main.o

INCDIR = 
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =
# My extra libs
LIBS = -lpng -lz

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Any help would be greatly appreciated, thanks !
holger
Posts: 204
Joined: Thu Aug 18, 2005 10:57 am

Post by holger »

try adding -lm to your LFLAGS/LDFLAGS/LIBS. Maybe you also want to update your toolchain (and move the old toolchain tree away to keep it clean) -- as far I know libpspglue.a is not used anymore.
maestun
Posts: 2
Joined: Thu Sep 01, 2005 9:07 pm

Post by maestun »

Thanks for your answer, I'll try this as soon as I can :)
By the way, what does the "-lm" flag mean ?

The other thing I was wondering : has the libpng to be recompiled from scratch each time I want to compile some code using it ?
It's this kind of error messages :

Code: Select all

pngrtran.c:(.text+0x1264): undefined reference to `pow' 
...that makes me think of this (since pngrtran.c is part of the libpng distribution)

EDIT :
--------
Okay, I added -lm (I guess it's the math funcs lib ?), also -lpspgu, everything compiles fine now.
Thank you very much for your help :)

***
Nb to admins : should I better create a new topic for these questions instead of posting here ?
User avatar
Agoln
Posts: 326
Joined: Wed Jun 08, 2005 3:14 am
Location: Fort Wayne, IN

Post by Agoln »

It's fine to post that here, cause others may have questions about it....

and yes, -lm links in the math library.
Lego of my Ago!
Mr.Modem
Posts: 28
Joined: Wed Sep 21, 2005 4:43 am

Post by Mr.Modem »

I get this error message when I run the toolchain script:

Code: Select all

***proc magic mismatch detected - 0xD94C588A/0xD079E02

This problem is probably due to using incompatible versions of the cygwin DLL
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version.  The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution.  Rebooting is also suggested if you
are unable to find another cygwin DLL.
no
configure: error: installation or configuration problem: C compiler can
e executables.
ERROR CONFIGURING BINUTILS
I've reinstalled cygwin and the DLL is the latest version. What should I do?
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

Sounds like you have two different versions of cygwin clashing somehow.

I once hit the same problem opening a bash window and running an older cygwin version of make (killing the build process that had been running in another window for 4 hours grumble grumble)
Mr.Modem
Posts: 28
Joined: Wed Sep 21, 2005 4:43 am

Post by Mr.Modem »

I don't think I have two version of Cygwin running
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

Did you follow the error instructions and see how many copies of "cygwin1.dll" you have on your machine?
Mr.Modem
Posts: 28
Joined: Wed Sep 21, 2005 4:43 am

Post by Mr.Modem »

I've reinstalled Cygwin (again) and I didn't get the error. I guess there were something wrong with my previous installation.
Kro
Posts: 10
Joined: Thu Sep 15, 2005 1:43 pm

Re: Tutorial problems

Post by Kro »

Modab wrote:The current one I am using inside of Dev-C++ is this:

Code: Select all

TARGET = bitmapViewer
OBJS = main.o pspBMP.o

INCDIR = 
CFLAGS = -O2 -G0 -Wall -I"C:\Program Files\PSPDev\include"
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Bitmap Viewer v0.1
PSP_EBOOT_ICON = icon.png
PSPSDK= C:/Progra~1/PSPDev/psp/sdk
include $(PSPSDK)/lib/build.mak
Small sugestion:
Keep directory structure in this manner:

Code: Select all

[X]
 |
 +--[Projects]
     |
     +--[MyProject1]
     |
     +--[MyProject2]
     |
     +--[MyProject3]
Where X is whatever you wish (DevCpp directory, its subdir, directory aoutside DevCpp - whatever). You can place Makefile.def inside Projects directory:

Code: Select all

CXXFLAGS=$(CFLAGS) -fno-exceptions -fno-rtti 
EXTRA_TARGETS = EBOOT.PBP 
include $(PSPSDK)/lib/build.mak
And for each project create makefile (and set as a custom makefile for given project), e.g.

Code: Select all

TARGET=MyProject
OBJS=main.o
PSP_EBOOT_TITLE=MyProject v0.1
#uncoment following line if you want (and have) custom icon
#PSP_EBOOT_ICON=icon.png
LIBS= -lpspgu

include ../Makefile.def
These are the only project-specific values for 90% of your projects (of course values assigned to variables will vary).

Some vars you've defined (INCDIR, CFLAGS, CXXFLAGS, ASFLAGS, LIBDIR, LDFLAGS) are already defined inside build.mak (%PSPSDK%\lib directory). The only value required is PSPSDK environment variable. Instead of typing it in, click right mouse button on My Computer (for Windows Vista: Computer), Properties, Advanced (tab), Environment Variables (button), New (for user or system variables - whatever you feel better; I'm developing on separate account, so user variable is ok for me). Setting environment variable is preferred over setting %PSPDEV% inside makefile.
First change that matters, my CFLAGS now has a -I"C:\Program Files\PSPDev\include" bit to it.
As stated before - only env var is required when using build.mak.
I changed "Program Files" to "Progra~1"
Just in case - use dir /x under command line to get DOS file/dir name. It is possible, that "Program Files" is not "Progra~1".
jsharrad
Posts: 100
Joined: Thu Oct 20, 2005 3:06 am

Post by jsharrad »

Is there any way to make it so dev-cpp can make a v1.5 eboot like using "make kxploit" in cygwin?
LordCthulu
Posts: 11
Joined: Thu Dec 29, 2005 12:32 am

Post by LordCthulu »

Followed the link in the first post, and there was only a folder, so I followed through a few folders and ended up here:

http://www.cs.purdue.edu/homes/ljbuesch/cs177/lab1/


Which...doesn't show how to setup Dev-C++ ^^;
(It's a quickie guide on Unix...lol)
UsefulIdiot
Posts: 13
Joined: Tue Jan 17, 2006 4:44 pm

Post by UsefulIdiot »

anyone got a mirror of this?
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

i nearly got it working now, but there is a linker error and i dunno what might be the problem.
...
-lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o .elf

/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/crt0.o: In function `_main':
/tmp/pspdev/pspsdk/src/startup/crt0.c:86: undefined reference to `main'
collect2: ld returned 1 exit status
...
maybe it's just a n00b-bug :(

btw. i try to compile the source off the controller sample, so there is an int main(void)..

greets
rapso
Schmede
Posts: 3
Joined: Sun Feb 12, 2006 7:27 pm

Post by Schmede »

@Agoln: Somehow your links is dead.
So would someone please post a new
link to the tutorial?

Thx
mako
Posts: 4
Joined: Tue Feb 21, 2006 8:11 am

Post by mako »

Schmede wrote:@Agoln: Somehow your links is dead.
So would someone please post a new
link to the tutorial?

Thx
ditto. Please link us, as I would love to be able to c for psp, but cygwin didn't work for me...
Post Reply