bzotto / dsk2woz2

Convert Apple II 5.25" DSK disk images into writeable WOZ 2.0 (Applesauce) disk images
MIT License
5 stars 1 forks source link

Compilation errors under Linux gcc 9.3 #1

Closed xandark closed 3 years ago

xandark commented 3 years ago

Compiling under Ubuntu Linux 20.04 with gcc 9.3, I get immediate compile errors:

dsk2woz2.c:45:5: error: unknown type name ‘uint32_t’
   45 |     uint32_t name;
      |     ^~~~~~~~

From this stackoverflow post, it seems that Visual C doesn't know about #include <stdint.h>. When I added it back, it compiled fine, but spit out 5 warnings about multi-character character constant [-Wmultichar], like 'WOZ2', 'INFO', etc. The program runs, but if these warnings are to be ignored, you can let us know in the compilation step.

bzotto commented 3 years ago

Hi, thanks for the note. The multi char constants may be implementation defined. I don't have Linux... Apple clang (both cc and gcc) compiles this with no errors/warnings. If your header include produces valid output despite the warnings, then you're all set. If it doesn't then the constants need more verbose assignment which you can edit for directly, or let me know and I'll get around to it. Thanks for the heads-up.

pyrex8 commented 3 years ago

I had the same problem in linux and gcc.

  1. I added #include
  2. I created a macro to convert 4 character strings into uint32_t
#include <inttypes.h>
#define S2I(x) ((((uint32_t)x[0]<<24) + ((uint32_t)x[1]<<16) + ((uint32_t)x[2]<<8) + ((uint32_t)x[3])))

and replaced 'WOZ2' with S2I("WOZ2") and the other single quote strings accordingly.

This makes the solution less compiler dependent.

bzotto commented 3 years ago

I modified the main c file to include stdint.h and stopped using the multi char literals. Hopefully this works for you folks without further edits. Thanks for flagging the challenges here.

bzotto commented 3 years ago

Updated with commit https://github.com/bzotto/dsk2woz2/commit/97a2100285ab935f96708efb7e2c1a809c9fd441

pyrex8 commented 3 years ago

Works great. Thanks!

xandark commented 3 years ago

Yep, builds flawlessly on Linux with GCC, thanks!