|
|
|
|
| Welcome, Guest | Home | Search | Login | Register | |
| Author | I'm following an ebook on Think C 5.0, but this program keeps crashing (Read 19802 times) | ||||||||||||||||||||||||||||||||||
|
ShinobiKenobi
256 MB ![]() ![]() ![]() ![]() ![]() Posts: 362 System 7 fan
|
on: April 03, 2024, 09:07
I'm following along in this ebook (modern browser needed), and I'm trying to run Hello2, and from what I can see, I've typed it exactly as they have it. However, when I run it, it always freezes up my iBook. It's running 8.6, and I'm using Think C 5.0 just like they are. I created the Hello2.π.rsrc file just like they showed. They're using System 7. Could there be some incompatibility with Think C 5.0 and Mac OS 8.6? If anyone could help me, I would greatly appreciate it. The Hello2 code is on page 76 in the book. Here's my code: #define kBaseResID 128 #define kMoveToFront (WindowPtr)-1L #define kHorizontalPixel 30 #define kVerticalPixel 50 /**************** Function prototypes *****************/ void ToolBoxInit(void); void WindowInit(void); void main(void) { ToolBoxInit(); WindowInit(); while ( !Button() ); } void ToolBoxInit(void) { InitGraf(&thePort); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(nil); InitCursor(); } void WindowInit(void) { WindowPtr window; window = GetNewWindow(kBaseResID, nil, kMoveToFront); if (window == nil) { SysBeep(10); // Couldn't load the WIND resource!!! ExitToShell(); } ShowWindow(window); SetPort(window); MoveTo(kHorizontalPixel, kVerticalPixel); DrawString("\pHello, world!"); } |
||||||||||||||||||||||||||||||||||
Last Edit: April 03, 2024, 09:12 by ShinobiKenobi
|
Bolkonskij
|
Administrator 1024 MB ![]() ![]() ![]() ![]() ![]() Posts: 2023
Reply #1 on: April 03, 2024, 09:12
|
From a quick glance, I'd say it's not an issue with your code, it's Think C's compiler that crashes on anything but 68k. I've experienced the same when trying to use it on a PPC. If you're on a PowerPC Mac, you'll want to use Code Warrior instead. (despite Think C being the better environment for the small hobby programming project, in my opinion). If you have a 68k machine set up, try running your code on it.
Last Edit: April 03, 2024, 09:14 by Bolkonskij
|
ShinobiKenobi
|
256 MB ![]() ![]() ![]() ![]() ![]() Posts: 362 System 7 fan
Reply #2 on: April 03, 2024, 09:17
|
Ohhhh, alright, thanks. I'll try to use CW. Does CW have similar libraries? The author had me add the precompiled MacTraps file to my project. I don't have a working 68K Mac, unfortunately. My Mac SE's hard drive won't boot, and I don't have an 800K floppy in order to reinstall the system ![]() Thank you for the quick reply!
Last Edit: April 03, 2024, 09:20 by ShinobiKenobi
|
cballero
|
1024 MB ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1176 System 7, today and forever
Reply #3 on: April 03, 2024, 20:21
|
Depending on the OS you're using, emaculation.com should have all of the instructions on setting-up Basilisk II with a 68k Mac OS on your modern Mac, PC or Linux system. Interestingly, the same project I've used to load SheepShaver with no issues on Linux under Wine also offers downloads of pre-configured packages with Basilisk II running Mac OS 8.1 and 7.6.1 as well as 7.5.5, 7.1 and 7.0.1, all ready to install and boot, no need to look for any other files (except the ones you'll install, like Think C 5.0!) ![]() https://mendelson.org/macos9osx.html (modern browser) I've set up plenty of OSes running with Basilisk II, but this way cuts right to the usage of the OS, bearing in mind it will likely come with other things pre-installed, any that you can use or delete.
|
ShinobiKenobi
|
256 MB ![]() ![]() ![]() ![]() ![]() Posts: 362 System 7 fan
Reply #4 on: April 04, 2024, 00:15
|
Awesome, thank you very much for that info cballero. At the time I started this topic, I didn't know Think C was 68K only. I would like to make my programs compatible with 68K, but also for PowerPC, so I'll just use CW exclusively. I thought as long as it ran in 68K, it would work in PPC, but I was wrong.
|
cballero
|
1024 MB ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1176 System 7, today and forever
Reply #5 on: April 04, 2024, 01:24
|
So AFAIK, all 68k apps will work on PowerPC Macs since the Classic OS can interpret the code, although it won't be FAT ![]() But I totally 100 percent get where you're coming from, so no worries there!
|
Jatoba
|
256 MB ![]() ![]() ![]() ![]() ![]() Posts: 270 System 9 Newcomer!
Reply #6 on: April 04, 2024, 05:42
|
You could also try Symantec C++ on PowerPC, we have it in the Garden. Isn't that the direct successor of THINK C, anyway? I think it is not restricted to C++ alone. You also should be able to use libraries from THINK C or CW in either product: C code is just C code in the end. (Well, assuming it's the same variant of C, like ANSI C89, also known as ISO C90.)
|
lauland
|
512 MB ![]() ![]() ![]() ![]() ![]() Posts: 674 Symtes 7 Mewconer!
Reply #7 on: April 08, 2024, 01:49
|
I agree with Jatoba: I've used Symantec C++ 6 extensively on 8.6 and 9.0 native, and also in Classic on MacOS X. Version 6 is still m68k only, and quite small. I wrote more about mixing compilers in another thread to you so I won't repeat! As far as libs, there are three kinds you'll run into: 1) Standard C/C++ ones (fopen, open, exit, etc) 2) Mac Toolbox (InitGraf, GetNewWindow, etc) 3) Compiler specific ones like toolkits or class libraries like CW's powerplant. If you avoid the 3rd kind, you can use pretty much any compiler. Since most of the toolkits try to encapsulate and hide the "gory details" of the Mac Toolbox, if you aren't afraid of it, there's no need to use them (and tie yourself to a particular compiler). (And you can use "generic" mac programming books).
|
ShinobiKenobi
|
256 MB ![]() ![]() ![]() ![]() ![]() Posts: 362 System 7 fan
Reply #8 on: April 08, 2024, 07:38
|
Awesome, thanks everyone!
|
|
Pages: [1]
|
| |||||||||
|
© 2021 System7Today.com. |





