Croteam-official / Serious-Engine

An open source version of a game engine developed by Croteam for the classic Serious Sam games.
GNU General Public License v2.0
3.03k stars 366 forks source link

Fix compilation when build path is long #22

Closed aron1024 closed 8 years ago

aron1024 commented 8 years ago

Also remove generated file Parser.cpp

Ragora commented 8 years ago

I always did find it rather peculiar that one of the suggested actions for resolving compile errors was to reduce the length of the file path.

SLAwww commented 8 years ago

Finally someone found the cause of that, thank you! Debugging didn't really help find the reason of the problem with paths, I'm not sure why I didn't look into Scanner.l myself. But I had to replace snprintf with sprintf because snprintf was not recognized by VS 2013 compiler.

aron1024 commented 8 years ago

I found the issue because VS 2015 reported a stack overrun in Ecc for certain *.es files in my build - that's why I also switched it to use the safer snprintf. I think all versions of VS have _snprintf instead but apparently that works slightly different than the standard snprintf. Anyway, in this case a buffer size of 512 with sprintf is more than enough for Windows (which enforces a max path length of 260 on every file) and should also suffice for other platforms.

gogirl2016 commented 8 years ago

Server