'Hello World' help :/ (palmos:gcc:sdk4)

Started by
7 comments, last by TDragon 18 years, 7 months ago
I'm using: linux 2.4.29 (i686) (slackware 10.1) prc-tools-2.3-i486-2ajl palmos SDK 4 (first tried 5.3r but same problems then too) POSE 3.5 and trying to get chapter 3's "Hello World" example working from Palm OS GAME Programming, by Nicholas Pleis ISBN: 1-931841-19-5 to compile I do this: m68k-palmos-gcc -palmos4 -c main.cpp m68k-palmos-gcc *.o -o main m68k-palmos-obj-res main build-prc hello_world.prc "Hello" GPP0 *.grc (no errors are given during compiles, btw) I then get a *.prc to compile and install in the emulator but then when I open it in POSE it gives three errors and needs a reset :( errors: ########################### Hello (unknown version) called SysFatalAlert with the message: "UIResource.c, Line:88, Resource for app form 1004 not found". ------------------ Hello (unknown version) called SysFatalAlert with the message: "MemoryMgr.c, Line:4365, NULL handle". ------------------ Hello (unknown version) called SysFatalAlert with the message: "MemoryMgr.c, Line:4450, Nil Ptr".Hello (unknown version) just read from memory location 0xFFFFFFF8, causing a bus error. A "bus error" means that the application accessed a memory location that is not in RAM or ROM, nor corresponds to a memory-mapped hardware register. ########### I looked at the *.h and they are what the book gave me on the CD-ROM except I fixed a punctuation with the include header from a 'c' to a 'C' and it seems fine but why all the errors? What am I doing wrong? Why can't I even make 'Hello World'?! I checked and the publisher of the book has no errata...actually they don't even have a working web site :( http://www.premierpressbooks.com/ here are the files I'm using when I compile I left the intermediate files in there too *.grc, *.o palm_woes.tar.gz 15kb Also, I've ran palmdev-prep as root and it gives no errors. Please help. ^_^' p.s. the example from the book's CD-ROM itself even gives some memory leak errors after it displays Hello World. :{ [Edited by - cppgirl on September 20, 2005 2:43:27 PM]
Advertisement
Quote:Original post by cppgirl
Hello (unknown version) called SysFatalAlert with the
message: "UIResource.c, Line:88, Resource for app form
1004 not found".


------------------

Hello (unknown version) called SysFatalAlert with the
message: "MemoryMgr.c, Line:4365, NULL handle".

------------------

Hello (unknown version) called SysFatalAlert with the
message: "MemoryMgr.c, Line:4450, Nil Ptr".

Those messages point to the lines you should look at in the files specified, and the errors identified. Null handle and null pointer mean that a system resource identifier and a memory address, respectively, were zero and then passed to some access procedure. You should be able to fix them. In the first case, you might need to acquire a valid handle, while you might need to allocate memory to the pointer in the second.

It's also probably a good idea to get comfortable with gdb, the GNU debugger, so you can step through your code, examine variables, set breakpoints, control loop iterations and generally see what's going wrong.

Oh, and don't cross post. Just find the forum that most closely matches your needs and stick to it.
that wasn't helpful.

And if I knew how to debug it I wouldn't be reading chapter three and asking how to compile 'Hello World'

and I don't have those files. they are already compiled I think ?

I only have the *.h's

how is not cross posting going to help? I'm not cross posting in this site. It doesn't affect you at all.

[Edited by - cppgirl on September 20, 2005 3:11:03 PM]
Quote:Original post by cppgirl
that wasn't helpful.

And if I knew how to debug it I wouldn't be reading chapter three and asking how to compile 'Hello World'

False assumption on my part. I thought that, since you were trying to compile for Palm OS, you were already comfortable developing on PC. If you aren't, well, you're in for a very nasty experience. Enjoy it.

Quote:and I don't have those files. they are already compiled I think ?

I only have the *.h's

You can't only have the header, or there'd be a link error. You have to at least have .lib or .obj files. Either way, the fault would seem to be in your code, so why not post it? Or are we supposed to magically divine what your problem on an unfamiliar system with a codebase we haven't seen is? Specifying the problem as completely as possible often helps.

Quote:how is not cross posting going to help? I'm not cross posting in this site. It doesn't affect you at all.

If it's not cross-posted to this site, why'd you tell us? The problem I was addressing is people who, say, post to For Beginners and Game Programming. Cross-community posting is not "cross-posting."
Quote:Or are we supposed to magically divine what your problem on an unfamiliar system with a codebase we haven't seen is?


I have a link to the files in my original post on this very server...

have you actually used prc-tools with SDK 4? If not, you are just saying abstract things like learn how to debug...that doesn't help I was looking for specific help. that is why I also copied and pasted this into more advanced forums on other palmos sites.
Was hoping (slim chance) that somebody with actual knowledge and experience of what I'm trying to do would reply...
Quote:Original post by cppgirl
<emo>

Actually, I'm saying very specific things, even though I haven't used (and will never use) prc-tools. You're just not getting my point.

I'm not going to download an archive, wade through it to find your hello world example and then look at the relationship to the SDK. That's your job. If you want responses from a platform-agnostic by predominantly PC-centric community, you'll have to make some PC-centric concessions (or I can move the thread to Consoles, Cell Phones and PDAs if you prefer). I've programmed on enough platforms to be able to tell you what the problems are: you have an invalid system resource handle, possibly the result of not checking that the acquisition routine returned correctly, and a null pointer where a pointer to memory was expected. Given that you don't actually know how to program in C and C++ (I've read your journal), these are very common beginner mistakes.

Also, you're learning from a book in the mistaken belief that the book text is correct. On principle, I don't buy texts that include anything more than a snippet of source code, because understanding the concepts behind the code is far more important.

But feel free to get all self-righteous and indulgent. Hey, it's not my code that doesn't work.
Where's the tFRM file that defines the form with the id 1004? The very first error you get is that the form with that id can't be located.
The problem appears to be that cppgirl has forgotten a step:
pilrc chapter3.rcp

And just for the record, PalmOS is MUCH easier to program than Windows-based PC programs. That book is known for having memory leak issues, so take all of its code with a grain of salt.
Quote:Original post by Anonymous Poster
And just for the record, PalmOS is MUCH easier to program than Windows-based PC programs.


That depends on the nature of your program; consider the following which will compile and run with all modern C++ compilers (add a .h to the include and work with legacy compilers too) for all releases of Windows:
#include <iostream>int main(int argc, char *argv[]){    cout << "Hello, world!" << endl;    return 0;}


The ease of programming for a particular OS, or a particular "anything", is largely dependant on the tools you use, the task you're trying to accomplish, and most of all your previous experience with it.

P.S. - I can spout the Win32 equivalent if you like, which is marginally more complex but not so much as the OP's source.
{[JohnE, Chief Architect and Senior Programmer, Twilight Dragon Media{[+++{GCC/MinGW}+++{Code::Blocks IDE}+++{wxWidgets Cross-Platform Native UI Framework}+++

This topic is closed to new replies.

Advertisement