sehugg / 8bitworkshop

web-based IDE for 8-bit programming and Verilog development
http://8bitworkshop.com/
GNU General Public License v3.0
510 stars 83 forks source link

make error 1 on some folders when opening files in VSCode #182

Closed DoctorMikeReddy closed 8 months ago

DoctorMikeReddy commented 8 months ago

I have been experimenting with your code examples using VSCode, as I am teaching with your book with some second year games students. I have forked from the repo at: https://github.com/WillSams/Making-Games-For-The-NES-book-examples which I know is not an official repo, but uses the examples from the book without requiring 8bitworkshop; I have modified the makefiles to include compile.bat files for Windows. However, apart from 01_hello_world and 12_title_screen_rle all of the other projects have the following error when compiling with cl65:

Error: ./../neslib/neslib.h:300: Error: Macro redefinition is not identical 1 errors and 0 warnings generated. make: *** Error 1

I can get round the error by commenting out line 300 in neslib.h: 300 // #define NULL 0

Any idea where else NULL is being defined, assuming that is the error?

sehugg commented 8 months ago

I would guess it's a newer version of CC65 which defines the NULL macro differently, maybe (void*)0 instead of just 0. That's my best guess, you'd have to check the CC65 include files. But if your fix works, then it works! :)

DoctorMikeReddy commented 8 months ago

What's weird is it's not needed for two of the examples. Fortunately, they both work with line 300 commented out. Yes, using the latest cc65. I'll investigate.

P.S. Love the book, and the web site of course, and recommended our library get paper and digital copies

DoctorMikeReddy commented 8 months ago

Ok, have found a NULL define here in cc65:

https://github.com/cc65/cc65/blob/master/include/stddef.h

/ NULL pointer /

ifndef NULL

define NULL ((void *) 0)

endif

So, I'm guessing this must be happening first in the cases where the code doesn't compile, before the NULL definition in your version of neslib.h tries