malloc,free and other C functions - undeclared problem

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

Moderators: cheriff, TyRaNiD

Post Reply
gambiting
Posts: 154
Joined: Thu Aug 17, 2006 5:39 pm

malloc,free and other C functions - undeclared problem

Post by gambiting »

Hi! This problem was mentioned in my other thread,but I made a separate one to have a higher chance of succes.The problem is that all files from my port of Xmoto linux game compile succesfully,but at linking stage it shows:

Code: Select all

psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -O2 -Wall -D_PSP_FW_VERSION=150  -L. -L/usr/local/pspdev/psp/sdk/lib   GameMain.o BuiltInFont.o Image.o VApp.o VBezier.o VDraw.o VDrawOpenGL.o PolyDraw.o VDrawSDLgfx.o VFileIO.o VTexture.o VXml.o DBuffer.o CRCHash.o Theme.o WWW.o Locales.o Packager.o BSP.o Game.o GameMenus.o GUIBestTimes.o GUIButton.o GUI.o GUIFrame.o GUIList.o GUIStatic.o GUITabView.o MotoGame.o MotoGameL.o MPhysics.o PlayerData.o Renderer.o RendererInit.o Replay.o Sound.o UserConfig.o GUIXMoto.o RendererParticles.o RendererBike.o Input.o GameSerializer.o Collision.o GUIEdit.o RendererFBO.o ReplayList.o Stats.o ScriptDynamicObjects.o SomersaultCounter.o GameEvents.o Credits.o GameInit.o GameDrawFrame.o LevelsManager.o xmscene/Level.o xmscene/Zone.o xmscene/Block.o xmscene/Entity.o xmscene/SkyApparence.o xmscene/BikeController.o xmscene/BikeParameters.o xmscene/BikeAnchors.o xmscene/Bike.o image/tim.cpp image/tim_io_stdio.cpp image/tim_jpeg.cpp image/tim_memory_crt.cpp image/tim_png.cpp md5sum/md5.c md5sum/md5file.cpp helpers/VMath.cpp helpers/SwapEndian.cpp helpers/FileCompression.cpp helpers/Color.cpp BuiltInFont.cpp Image.cpp VApp.cpp VBezier.cpp VDraw.cpp VDrawOpenGL.cpp PolyDraw.h PolyDraw.cpp VDrawSDLgfx.cpp VFileIO.cpp VTexture.cpp VXml.cpp tinyxml/tinystr.cpp tinyxml/tinyxml.cpp tinyxml/tinyxmlerror.cpp tinyxml/tinyxmlparser.cpp -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -lGL -lpspvfpu -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lstdc++ -llua -lglut -lGLU -lGL -lode -lSDL -lSDLmain -lSDL_gfx -lSDL_mixer -lpng -ljpeg -lz -lpsprtc  -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspaudio -lc -lpspuser -lpspkernel -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspuser -lpspkernel -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpsplibc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o Xmoto.elf
image/tim.cpp: In function ‘int tim_get_bytes_per_pixel(tim_pixel_type_t)’:
image/tim.cpp:332: warning: enumeration value ‘TIM_PT_UNKNOWN’ not handled in switch
image/tim_jpeg.cpp: In function ‘int tim_jpeg_load(tim_session_t*, tim_image_t**, tim_image_info_t*, char*)’:
image/tim_jpeg.cpp:545: error: call of overloaded ‘strcasecmp(char*&, const char [6])’ is ambiguous
/usr/local/pspdev/psp/sdk/include/libc/string.h:76: note: candidates are: int strcasecmp(const char*, const char*)
image/tim_jpeg.cpp:41: note:                 int strcasecmp(char*, char*)
image/tim_jpeg.cpp:546: error: call of overloaded ‘strcasecmp(char*&, const char [6])’ is ambiguous
/usr/local/pspdev/psp/sdk/include/libc/string.h:76: note: candidates are: int strcasecmp(const char*, const char*)
image/tim_jpeg.cpp:41: note:                 int strcasecmp(char*, char*)
image/tim_jpeg.cpp:581: warning: comparison between signed and unsigned integer expressions
image/tim_jpeg.cpp: In function ‘int tim_jpeg_save(tim_image_t*, char*)’:
image/tim_jpeg.cpp:666: warning: comparison between signed and unsigned integer expressions
image/tim_jpeg.cpp: At global scope:
image/tim_jpeg.cpp:41: warning: ‘int strcasecmp(char*, char*)’ defined but not used
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
./MotoGame.h:101: warning: ‘class vapp::MotoGameHooks’ has virtual functions but non-virtual destructor
helpers/FileCompression.cpp:26:21: error: bzlib.h: No such file or directory
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
helpers/FileCompression.cpp: In static member function ‘static void FileCompression::bunzip2(std::string, std::string)’:
helpers/FileCompression.cpp:34: error: ‘BZFILE’ was not declared in this scope
helpers/FileCompression.cpp:34: error: ‘b_in’ was not declared in this scope
helpers/FileCompression.cpp:45: error: ‘BZ2_bzReadOpen’ was not declared in this scope
helpers/FileCompression.cpp:46: error: ‘BZ_OK’ was not declared in this scope
helpers/FileCompression.cpp:47: error: ‘BZ2_bzReadClose’ was not declared in this scope
helpers/FileCompression.cpp:60: error: ‘BZ_OK’ was not declared in this scope
helpers/FileCompression.cpp:62: error: ‘BZ2_bzRead’ was not declared in this scope
helpers/FileCompression.cpp:63: error: ‘BZ_STREAM_END’ was not declared in this scope
helpers/FileCompression.cpp:67: error: ‘BZ2_bzReadClose’ was not declared in this scope
helpers/FileCompression.cpp:76: error: ‘BZ_STREAM_END’ was not declared in this scope
helpers/FileCompression.cpp:77: error: ‘BZ2_bzReadClose’ was not declared in this scope
helpers/FileCompression.cpp:82: error: ‘BZ2_bzReadClose’ was not declared in this scope
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
./MotoGame.h:101: warning: ‘class vapp::MotoGameHooks’ has virtual functions but non-virtual destructor
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
VDrawOpenGL.cpp: In member function ‘virtual void vapp::DrawLibOpenGL::startDraw(vapp::DrawMode)’:
VDrawOpenGL.cpp:360: warning: enumeration value ‘DRAW_MODE_NONE’ not handled in switch
VDrawOpenGL.cpp: In member function ‘virtual void vapp::DrawLibOpenGL::setBlendMode(vapp::BlendMode)’:
VDrawOpenGL.cpp:416: warning: converting to non-pointer type ‘int’ from NULL
VDrawOpenGL.cpp:416: warning: NULL used in arithmetic
PolyDraw.h:4: error: syntax error before ‘vapp’
PolyDraw.h:4: error: syntax error before ‘{’ token
PolyDraw.h:12: error: syntax error before ‘}’ token
PolyDraw.h:15: error: syntax error before ‘*’ token
PolyDraw.h:15: warning: type defaults to ‘int’ in declaration of ‘PolyDraw’
PolyDraw.h:15: warning: data definition has no type or storage class
PolyDraw.h:19: error: syntax error before ‘*’ token
PolyDraw.h:21: error: syntax error before ‘SDL_Surface’
PolyDraw.h:23: error: syntax error before ‘:’ token
PolyDraw.h:26: warning: type defaults to ‘int’ in declaration of ‘m_pLeftEdge’
PolyDraw.h:26: warning: type defaults to ‘int’ in declaration of ‘m_pRightEdge’
PolyDraw.h:26: warning: data definition has no type or storage class
PolyDraw.h:30: error: syntax error before ‘EdgeValue’
PolyDraw.h:33: error: syntax error before ‘EdgeValue’
PolyDraw.h:37: error: syntax error before ‘}’ token
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
./MotoGame.h:101: warning: ‘class vapp::MotoGameHooks’ has virtual functions but non-virtual destructor
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
VXml.cpp: In static member function ‘static std::string vapp::XML::str2xmlstr(std::string)’:
VXml.cpp:82: warning: comparison between signed and unsigned integer expressions
make: *** [Xmoto.elf] Error 1
I know that those BZ2 errors are because I don't have bz2 libriary for psp(do you know if there's one?It's not on svn),but I completely don't understand problems about "malloc","free","call of overloaded ‘strcasecmp(char*&, const char [6])’ is ambiguous" and other C related functions.Could you take a look at it?Just in case I've already uploaded my project here:
http://rapidshare.com/files/33133005/src.zip
Thanks in advance.
gambiting
Posts: 154
Joined: Thu Aug 17, 2006 5:39 pm

Post by gambiting »

Anyone? I've solved all problems,but not not these:

Code: Select all

/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:103: error: ‘::calloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:106: error: ‘::free’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:110: error: ‘::malloc’ has not been declared
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../include/c++/4.0.2/cstdlib:118: error: ‘::realloc’ has not been declared
Could you help?
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Make sure you've included stdlib.h in all your files where you use them, and if that doesn't fix it, try adding 'using namespace std;' to the start of those files where you use them.

Jim
Post Reply