• Hello, Guest! Welcome back, and be sure to check out this post for more info about the recent service interruption and migration.

Metrowerks CodeWarrior Best Version and Updates

David Cook

Well-known member
There are a number of threads on this forum regarding present-day development with Metrowerks CodeWarrior. I have a couple of projects in mind, but first need to select a development environment.

Historically, I began with Lightspeed C on a Mac SE and continued through Symantec C 7.0.5 / 8.0.3 on a Mac IIci. Compiler bugs and slowness caused me to switch over CodeWarrior 7 on a Power Macintosh 6100 in late 1995. My Mac career concluded with CodeWarrior Pro 2 on a Power Macintosh 8500 in late 1997.

As I have the CodeWarrior Pro 2 environment set up from years ago, that would be the easiest answer. My criteria for other CW candidates are:
1. A development environment that other people could replicate for collaboration. So, the original installer and update files should be publicly available.
2. Fewest known bugs/crashes, because we aren't going to get support or updates.
3. C/C++ compiler. The Pascal, Java, and Windows compilers aren't relevant to my needs.
4. Ability to make 68K, PPC, and fat binaries
5. Produces output compatible with System 6.0.7 through 8.1 (last 68040 support). Environment must run on 7.5.5 (last 68000 support) and 8.1 (HFS+ nice for SSDs).
6. Environment runs on Basilisk, Quadra 630/650, Power Macintosh 7300.

Candidates:
CodeWarrior Pro 5: Disqualified because it doesn't run on 68K Macs. Wikipedia says it is compatible by reference to this 2001 article.CodeWarrior-Pro-5-Article.png

But, trying to run the CW 5 IDE (which is poorly named 4.0) let's you know the installer was not joking. Mingling the old IDE with the new compiler might work, but I feel like there needs to be a compelling reason to ask people to hybridize.

1665350110426.png

CodeWarrior Pro 4: CD ISO is available. The updates are available as part of the massive FTP dump.

After downloading the 5 GB file, you'll need to use a tool like 7-Zip to extract the archive, as Windows thinks the zip is corrupt due to overflowing the 32-bit limit. For those interested, I pulled the update files for the C/C++ compiler and uploaded those to the repository.

After updating, you need to recompile the MSL libraries. Unfortunately, this is where I discovered that the PowerPC portion apparently doesn't compile on 68K hardware or an emulator. I tried Basilisk, Quadra 630, and a Quadra 650 on System 7.5.5 and System 8.1 (even with minimal extensions and with virtual memory on/off) without luck. However, booting from that same drive on a Power Macintosh 7300 compiled everything just fine.

That caused me to test compiling my old programs under the same conditions. Shockingly, the PPC compiler crashes or produces an 'internal error' on 68K machines, but works on the Power Macintosh. I tried CodeWarrior Pro 2 with my own programs, and it also won't successfully compile on a 68K machine (but will on the Power Macintosh). In contrast, compiling the same code but for 68K binaries works in all environments.

At some point, did the Metrowerks team just assume all developers switched over to PowerPC machines for PPC and Fat compiles? How far back do I need to go to find a version of CodeWarrior that outputs PPC binaries on a 68K platform?

CodeWarrior Pro 3: CD ISO is available. The updates are available as part of the massive FTP dump. Haven't tested.

CodeWarrior Pro 2: CD ISO is available. The updates are available as part of the massive FTP dump. Crashes when compiling my PPC code on 68K machines.

CodeWarrior Pro 1: CD ISO and updates available. Another thread suggested people standardized on this release. Does anyone know why?

At this point, I am open to suggestions. Does anyone have any reasoning behind using a particular version (like fewer bugs or improved IDE or nice C extensions)?
 

Corgi

Well-known member
Does anyone have any reasoning behind using a particular version (like fewer bugs or improved IDE or nice C extensions)?
It's probably not helpful for your case, obviously, but I standardised on CW Pro 6 and have it installed on my 1400c (with G3 upgrade), beige G3, and various G4s. I can still build for 68K, but I have no interest in hosting on 68K.

This is also the version of CW I used in 2011 to port some of the software I was working on to Mac OS 9. I actually had a full set of modern Web libraries with TLS 1.2, XML serdes, and such all working. Now I kinda desperately want to see if I can get that going again, but targeting FAT binaries and down to 7.5 or 7.1 (with OT).

edit: I picked CW Pro 6 also because it has full C++98 and C99 support, even though at that point it was still a draft standard. A lot of libraries can still be convinced to build with C99. I recall trying CW Pro 3 in 2011 and finding its standards compliance rather lacking in that department, but I don't recall the exact issues I had.
 

Crutch

Well-known member
Am I crazy in thinking CW could never compile PPC code on a 68K Mac? I recall using CW non-Pro 1.0 and am pretty sure there were separate apps for the 68K and PPC compilers, and that the PPC compiler app was PPC-native and not fat.
 

David Cook

Well-known member
I picked CW Pro 6 also because it has full C++98 and C99 support

C99 is exactly the sort of improvement I was hoping for. Specifically, intermingled declarations and code. Unfortunately, as you point out, Pro 6 won't host on 68K.

Am I crazy in thinking CW could never compile PPC code on a 68K Mac?

That got me interested in testing it. I downloaded Code Warrior 11 and applied the updates except for the MSL. It successfully compiles PPC code on a 68k Mac! Also, CW 11 runs on 68020 through PowerPC, System 7.1 through at least 8.1 (tested). So, this is a valid candidate.

Since Pro 2 and Pro 4 partially compile and then crash, I think it is fair to say that the PPC compiler was originally designed to work on 68k but they likely introduced a bug at some point that went untested.
 

David Cook

Well-known member
Something very interesting about the transition from CodeWarrior 11 to Pro. They flipped the switch to disable the old Inside Macintosh names and definitions. In fact, the flip occurs in CodeWarrior 11 MSL update patch 2.1.1. So, don't install that if you have an old code base or regularly refer to Inside Macintosh I-VI, rather than the later named volumes ("Inside Macintosh: Devices").

CW11 to pro.PNG

Earlier system calls, constants, and variables had names that were at times too generic, conflicting, or misspelled (DisposPtr). The system and applications were continuing to became more complex with larger code bases, libraries, and constants. There was a desire to start having dynamically bound libraries that could be updated instead of systems and ROMs. And, PowerPC hardware and modernized OS made some calls do nothing (SetSoundVol and SetChooserAlert). So, Apple wanted to clean up.

For example. InsMenuItem becomes a more readable InsertMenuItem. Generic sounding SetItem becomes SetMenuItemText.

Name changes.PNG

Some names were so generic and common that they would conflict with variables and enums you might want to define in your own code. I mean, if you use QuickDraw then you couldn't define your own 'fill'. So, they gave the QuickDraw 'fill' an unwieldy new name that was unlikely to conflict with anything you wanted for variable names.

QDname.PNG

During the transitional periods, the headers supported both the old and new names. At a certain point, they turned off the old names. Although understandable, this broke old code without providing a helpful error message. A developer referring to Inside Macintosh I-VI would be left scratching their head. "But, DisposCIcon is in Quickdraw!". Little did they know it is now DisposeCIcon in Icons.h.

Anyway, I just wanted to alert people to this transitional period in case it bites you on an old code base.

- David
 

Corgi

Well-known member
C99 is exactly the sort of improvement I was hoping for. Specifically, intermingled declarations and code. Unfortunately, as you point out, Pro 6 won't host on 68K.

Funny, that's the one C99 feature I don't use. Years and years of targeting Visual C++ taught me to never rely on that working. I can't find any reference back to CW 10 Gold about when the feature was added to CW.

That got me interested in testing it. I downloaded Code Warrior 11 and applied the updates except for the MSL. It successfully compiles PPC code on a 68k Mac! Also, CW 11 runs on 68020 through PowerPC, System 7.1 through at least 8.1 (tested). So, this is a valid candidate.

Since Pro 2 and Pro 4 partially compile and then crash, I think it is fair to say that the PPC compiler was originally designed to work on 68k but they likely introduced a bug at some point that went untested.

Now you have me wondering: could this have anything to do with the version of the CFM 68K Enabler you're running? I believe CW Pro releases required that on 68k machines, and it was notoriously buggy…

That said, I found a reference online that states:

Another implementation difference is the size of int. In MPW and CodeWarrior PPC int is 4 bytes. In CodeWarrior 68K it is 2 bytes unless you tell CodeWarrior 68K to use 4 byte ints in the "Processor" section of the preferences. Make sure you tell CodeWarrior that ints are 4 bytes if you depend on this. Ideally you should only use ints when you don't care how big int is and long and short when you do.

Maybe Metrowerks themselves forgot this and didn't bother to ever test the PPC compiler on 68k, and that's why it is broken.
 

cheesestraws

Well-known member
This is a really interesting thread, please keep talking :).

(I don't tend to build stuff for PPC that isn't PPC-only, so I have nothing to add here, really)

So, Apple wanted to clean up.

Yeah, this makes using older sample code also kind of painful, but the increase in readability afterwards is a lovely thing to see...
 

pfuentes69

Well-known member
Also quite interested... I'm right now in a project using Symantec C++ 7 and I'm not too satisfied. I get funky errors when using the FPU and some other issues.

What would be the recommended version of CW to run on a 68K and System 7?
 

Crutch

Well-known member
Gosh I would love it if there were a C99 compiler that runs on 68K. (There’s not, right?)
 
Top