Bigfoot71 / rlights

Lighting management system for raylib
MIT License
33 stars 5 forks source link

Header does not work in MSVC C++ #2

Open JeffM2501 opened 2 months ago

JeffM2501 commented 2 months ago

The header uses C style literals (Vector2){1,2}; this is not valid C++ code, and won't compile in MSVC's C++ compiler.

If this file is intended for C only, it should have a #define error if cpp is defined. if it is intended to work in C and C++ on all compilers, it should not use the C style code, and define specific variables.

Bigfoot71 commented 2 months ago

@JeffM2501 Thank you very much for reporting this issue.

I have just attempted a fix (https://github.com/Bigfoot71/rlights/commit/4b7e3f512bcb4ba697d9ea8d49b8954ebe57f401), and the code now compiles without apparent problems with G++ and Clang++.

Unfortunately, I do not currently have a testing environment for Windows with MSVC. If you could let me know if it works on your side, that would be great!

JeffM2501 commented 2 months ago

No that does not fix it, you still have tons of places that use c literals. Search the code for '){' there are a bunch of them left.

Bigfoot71 commented 2 months ago

@JeffM2501 Sorry for the rush, they should all be replaced now, and I also fixed the warnings received with g++ ... -Wall (https://github.com/Bigfoot71/rlights/commit/954edb12f1b0fa41947fa1e597aa91452f9f0759 - https://github.com/Bigfoot71/rlights/commit/7461a7b829f9213e9aa602ed35752b99a200ab7a)

JeffM2501 commented 2 months ago

Better, but designated initializers require C++20 image

Bigfoot71 commented 2 months ago

@JeffM2501 I don't think I've seen other similar cases in the code, this case is fixed (https://github.com/Bigfoot71/rlights/commit/ac15b97ad70182f2749918b7278da45843044f1e)

I compiled several rewritten examples with g++ ... -std=c++11 and g++ ... -std=c++17 without any error or warning on my side

Bigfoot71 commented 1 month ago

@JeffM2501 Was it good on your side?