cemyuksel / cyCodeBase

An open source programming resource intended for graphics programmers.
MIT License
271 stars 60 forks source link

strncmp issue including cyHairFile.h under gcc 6.2.0 #2

Closed povmaniaco closed 7 years ago

povmaniaco commented 7 years ago

Hello Mr. Yuksel I am using your cyHairFile file.h in my personal project, under MSVC 2015 in Windows 10 Pro x64. I have only encountered a small problem when I try to compile an small test with GCC 6. 2. 0

Thread model: win32
gcc version 6.2.0 (x86_64-win32-sjlj-rev1, Built by MinGW-W64 project)

C:\devs\hair>c++ -std=c++11 -static-libstdc++ -static-libgcc -o hair -O3 hair.cpp
In file included from hair.cpp:3:0:
../repos/cyCodeBase/cyHairFile.h: In member function 'int cy::HairFile::LoadFromFile(const char*)':
../repos/cyCodeBase/cyHairFile.h:224:44: error: 'strncmp' was not declared in this scope
   if ( strncmp( header.signature, "HAIR", 4) != 0 ) _CY_FAILED_RETURN(CY_HAIR_FILE_ERROR_WRONG_SIGNATURE);
                                            ^

I have solved this problem by adding #include into my file before including cyHairFile.h I think it would be a good idea to report that cyHairFile.h need to include string.h

Thank you for this great piece of soft!!

cemyuksel commented 7 years ago

Including string.h in that file is a good idea. Thanks!