Eclipse, minPSPw and interesting problem

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

Moderators: cheriff, TyRaNiD

Post Reply
SkyWhy
Posts: 4
Joined: Fri May 22, 2009 3:12 am

Eclipse, minPSPw and interesting problem

Post by SkyWhy »

I'm currently setting up my PSP toolchain for windows.

I've followed everything in here:
http://www.jetcube.eu/archives/2008/02/entry_72.html

But the problem I run is the fact that when I compile eclipse gives me this error:

Code: Select all

**** Build of configuration Default for project pspHelloWorld ****

make all 
psp-gcc -I. -IC:/Programs/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L. -LC:/Programs/pspsdk/psp/sdk/lib   main.o -lstdc++   -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o main.elf
c:/programs/pspsdk/bin/../lib/gcc/psp/4.3.3/../../../../psp/lib/crt0.o: In function `_main':
../../../../pspsdk/src/startup/crt0.c:86: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [main.elf] Error 1
For some reason the _main cannot find the references to main. Is it problem with my makefile or a problem with my setup? Anyone has any ideas how to get this sorted? I'm pretty hungry to start developing for PSP but after two days of fighting with this I'm kind of running out of ideas.

If it helps at all, here is my makefile:

Code: Select all

TARGET = main
OBJS = main.o
LIBS = -lstdc++  

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = -fno-exceptions -fno-rtti
 
EXTRA_TARGETS = EBOOT.PBP

PSP_EBOOT_TITLE = $(TARGET)

PSPSDK=$(shell psp-config --pspsdk-path)

include $(PSPSDK)/lib/build.mak

%.o: %.cxx
	$&#40;CXX&#41; $&#40;CXXFLAGS&#41; -c -o $@ $<
AND here is my main.c

Code: Select all

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



/* Define the module info section */
PSP_MODULE_INFO&#40;"helloworld", 0, 1, 1&#41;;

/* Define the main thread's attribute value &#40;optional&#41; */
PSP_MAIN_THREAD_ATTR&#40;THREAD_ATTR_USER | THREAD_ATTR_VFPU&#41;;



int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;
	pspDebugScreenInit&#40;&#41;;
	pspDebugScreenPrintf&#40;"Hello World\n"&#41;;
	return 0;
&#125;

OH and if it helps, eclipse is complaining the PSP_MODULE_INFO() and PSP_MAIN_THREAD_ATTR() "contain syntax errors".

So if anyone knows where to look or what to do next, do shed some light into my problems.

Thanks guys.


- SkyWhy
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

replace psp-gcc with psp-g++ in the configuration

i had the same problem
SkyWhy
Posts: 4
Joined: Fri May 22, 2009 3:12 am

Post by SkyWhy »

Thanks for the reply hlide.

Replaced the psp-gcc with psp-g++ from the windows-> preferences, created completely new project with same content in .c file and in MakeFile.

Reports exactly the same error. But one thing I noticed and I don't know is it supposed to be this way.

When I hit build this is what I get:

Code: Select all

make all 
psp-gcc -I. -IC&#58;/Programs/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150   -c -o main.o main.c
psp-gcc -I. -IC&#58;/Programs/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L. -LC&#58;/Programs/pspsdk/psp/sdk/lib   main.o -lstdc++   -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o main.elf
c&#58;/programs/pspsdk/bin/../lib/gcc/psp/4.3.3/../../../../psp/lib/crt0.o&#58; In function `_main'&#58;
../../../../pspsdk/src/startup/crt0.c&#58;86&#58; undefined reference to `main'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;main.elf&#93; Error 1
After make all, there is still the magical psp-gcc, shouldn't it surely be psp-g++ if I'm not completely mistaken? I checked the project settings and Eclipse preferences and both say it's using the psp-g++, any ideas?
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

SkyWhy wrote:Thanks for the reply hlide.

Replaced the psp-gcc with psp-g++ from the windows-> preferences, created completely new project with same content in .c file and in MakeFile.

Reports exactly the same error. But one thing I noticed and I don't know is it supposed to be this way.

When I hit build this is what I get:

Code: Select all

make all 
psp-gcc -I. -IC&#58;/Programs/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150   -c -o main.o main.c
psp-gcc -I. -IC&#58;/Programs/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L. -LC&#58;/Programs/pspsdk/psp/sdk/lib   main.o -lstdc++   -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o main.elf
c&#58;/programs/pspsdk/bin/../lib/gcc/psp/4.3.3/../../../../psp/lib/crt0.o&#58; In function `_main'&#58;
../../../../pspsdk/src/startup/crt0.c&#58;86&#58; undefined reference to `main'
collect2&#58; ld returned 1 exit status
make&#58; *** &#91;main.elf&#93; Error 1
After make all, there is still the magical psp-gcc, shouldn't it surely be psp-g++ if I'm not completely mistaken? I checked the project settings and Eclipse preferences and both say it's using the psp-g++, any ideas?
sorry I thought you were building a C++ project as I did :/. In your case, psp-gcc should be okay at least. Are you sure main.c is providing a main function ?
SkyWhy
Posts: 4
Joined: Fri May 22, 2009 3:12 am

Post by SkyWhy »

I am building a c++ project.

New -> C++ project -> custom tool chain. I just happened to rename the main to main.c which really should not change a thing as far as I know. All though I haven't played around with my own MakeFiles ever. Been a Visual Studio slave for years.

And can I be sure my main is providing main function? As far as I can see, yes.

Code: Select all

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

PSP_MODULE_INFO&#40;"helloworld", 0, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;THREAD_ATTR_USER | THREAD_ATTR_VFPU&#41;;

int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;
   pspDebugScreenInit&#40;&#41;;
   pspDebugScreenPrintf&#40;"Hello World\n"&#41;;
   return 0;
&#125; 
Or am I missing out something completely?

EDIT #1:
When it comes to your own MakeFiles, there is a hell of a difference obviously. Just by renaming the main.c to main.cpp and it compiled.. gah!

Anyone any links to tutorials to understand MakeFiles a bit more deeper than this? This is starting to bug me like hell. About time I learned these darn things properly.

And thanks for the tips, got things working now :)
Post Reply