Compiling C++ code with PsyQ/Programmer's Tool SDK

General help for the PSY-Q SDK, such as setting the SDK up, compiling correctly, linking and debugging
Post Reply
User avatar
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 388
Joined: April 10th, 2013, 3:47 pm
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Location: Philippines

Compiling C++ code with PsyQ/Programmer's Tool SDK

Post by LameGuy64 » June 10th, 2018, 1:49 am

The SDevTC toolchain included in the PsyQ or Programmer's Tool SDK actually supports C++. You just need to pass it to ccpsx like you would with a C file.

Code: Select all

ccpsx -Xo0x80010000 -Wall -O2 main.cpp -o main.cpe
The compiler programs are actually cc1psx and cc1plpsx. ccpsx is merely a front-end.

You may want to make sure that there's a cplus_include_path variable in your PSYQ.INI/SN.INI file that points to your SDK's include directory if you experience compiler errors regarding missing header files. You can also specify it as an environment variable but be aware that it may get in the way of your existing C++ toolchains if you have one installed so I recommend just editing the INI file to avoid a conflict.

I haven't really tested which C++ features are supported but it does support class objects and you can define variables anywhere on your code unlike in C where you can only define variables before any procedure. I haven't checked what kind of allocator the compiler uses when dynamically creating and deleting class objects yet and I have a feeling it might be using the buggy malloc implementation in the BIOS.

Obviously, the C++ implementation is pre C++98 so you may want to be aware of that.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

Curious PSXDEV User
Curious PSXDEV User
Posts: 22
Joined: May 18th, 2015, 1:47 pm

Re: Compiling C++ code with PsyQ/Programmer's Tool SDK

Post by Sblorgz » June 10th, 2018, 2:12 am

Simply check which features were supported in GCC 2.8.1 and you will know what PSQY-Q's toolchain supports, since it's a modified GCC with custom linkable objects and overlay support through linker maps.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest