KelvinShadewing / brux-gdk

Free runtime and development kit using SDL and Squirrel
GNU Affero General Public License v3.0
39 stars 20 forks source link

Fix for realpath on mingw32 #12

Closed joseph-montanez closed 6 years ago

joseph-montanez commented 6 years ago

If you are on mingw32 you have access to fullpath. If you Codeblocks and built in mingw32, you need to add "-U__STRICT_ANSI__" to the compiler -> other compiler flags

joseph-montanez commented 6 years ago

Instead of setting the flag as -U__STRICT_ANSI__ you can uncheck the c++x11 flag and use this custom flag:

-std=gnu++11

I think CMake might already set this up but I have not tried its CodeBlocks support.

KelvinShadewing commented 6 years ago

I tried it, and it says _MAX_PATH isn't declared. If I use PATH_MAX instead, then it says _fullpath isn't declared. I unchecked C++11 and put in the compiler flag.

joseph-montanez commented 6 years ago

I guess some questions then.

Are you you added so your version in main.h? This has the _MAX_PATH defined. PATH_MAX should not be defined... unless its turned on POSIX compatibility.

What version of CodeBlocks do you have?

What version of GCC do you have?

What version of Windows do you have?

As a note the file that defines _fullpath is defined a mingw header . It might still require -U__STRICT_ANSI__

I did lookup why this is an issue and its something Mingw32 is never going to fix. I've looked at mingw64 and it had "POSIX" to be undefined as a requirement. So you might want to also try:

-UPOSIX

Reference: https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/crt/stdlib.h#L538

KelvinShadewing commented 6 years ago

CB: 16.01 Windows: 8 MinGW: 4.9 (came with CB)

joseph-montanez commented 6 years ago

Did you clean your project first? Make sure to clean and then build.

http://imgur.com/a/UHpxN

KelvinShadewing commented 6 years ago

Yup. Same error as before.

KelvinShadewing commented 6 years ago

What was wrong with what I was using before? I didn't have any problems with it. Why do I need this realpath() thing, anyway?

joseph-montanez commented 6 years ago

What was wrong with what I was using before? I didn't have any problems with it. Why do I need this realpath() thing, anyway?

Its support for relative paths. Before your runtime required the FULL path, which is really odd. I should be able to say something like "rte ../mygame.nut" and it should be able to look at my current working directory and load the script. Before it would require "rte /Users/josephmontanez/Documents/mygame.nut"

Maybe if we do a screenshare this would be quicker.