When I try to compile stockfish-1.2 on my Ubuntu 64-bit system I get this:
In file included from evaluate.h:29,
from main.cpp:31:
pawns.h: In member function ‘void PawnInfo::clear()’:
pawns.h:125: error: ‘memset’ was not declared in this scope
make: *** [main.o] Error 1
Any assistance in building a 64-bit native Linux binary for this engine is appreciated.
Roy
Stockfish-1.2 compile on Ubuntu - Error
Moderators: hgm, Rebel, chrisw
-
- Posts: 287
- Joined: Sat Mar 11, 2006 3:19 am
- Location: Atlanta, GA
Re: Stockfish-1.2 compile on Ubuntu - Error
Introduce the following line in the pawns.h file at the top of the file:
#include <string.h>
#include <string.h>
royb wrote:When I try to compile stockfish-1.2 on my Ubuntu 64-bit system I get this:
In file included from evaluate.h:29,
from main.cpp:31:
pawns.h: In member function ‘void PawnInfo::clear()’:
pawns.h:125: error: ‘memset’ was not declared in this scope
make: *** [main.o] Error 1
Any assistance in building a 64-bit native Linux binary for this engine is appreciated.
Roy
-
- Posts: 536
- Joined: Thu Mar 09, 2006 12:53 am
Re: Stockfish-1.2 compile on Ubuntu - Error
That got me further, but then this error occurred:
position.cpp:316: error: ‘memcpy’ was not declared in this scope
make: *** [position.o] Error 1
Thanks for the assistance!
Roy
position.cpp:316: error: ‘memcpy’ was not declared in this scope
make: *** [position.o] Error 1
Thanks for the assistance!
Roy
-
- Posts: 750
- Joined: Mon Mar 27, 2006 7:45 pm
- Location: Finland
Re: Stockfish-1.2 compile on Ubuntu - Error
Still the same problem, just in a different file.
-
- Posts: 750
- Joined: Mon Mar 27, 2006 7:45 pm
- Location: Finland
Re: Stockfish-1.2 compile on Ubuntu - Error
The .h extension is deprecated in modern C++. One should use #include <cstring> instead.Pradu wrote:Introduce the following line in the pawns.h file at the top of the file:
#include <string.h>
-
- Posts: 536
- Joined: Thu Mar 09, 2006 12:53 am
Re: Stockfish-1.2 compile on Ubuntu - Error
Sorry, I don't code in C or C++ or C# -- what file is :
#include <string>
needed in now?
I tried adding it to position.h but that did not work:
position.cpp: In member function ‘void Position::from_fen(const std::string&)’:
position.cpp:129: error: ‘strchr’ was not declared in this scope
position.cpp: In member function ‘void Position::copy(const Position&)’:
position.cpp:315: error: ‘memcpy’ was not declared in this scope
make: *** [position.o] Error 1
Thanks,
Roy
#include <string>
needed in now?
I tried adding it to position.h but that did not work:
position.cpp: In member function ‘void Position::from_fen(const std::string&)’:
position.cpp:129: error: ‘strchr’ was not declared in this scope
position.cpp: In member function ‘void Position::copy(const Position&)’:
position.cpp:315: error: ‘memcpy’ was not declared in this scope
make: *** [position.o] Error 1
Thanks,
Roy
-
- Posts: 750
- Joined: Mon Mar 27, 2006 7:45 pm
- Location: Finland
Re: Stockfish-1.2 compile on Ubuntu - Error
It's <cstring>, not <string>. You should put it in position.cpp.royb wrote:Sorry, I don't code in C or C++ or C# -- what file is :
#include <string>
needed in now?
I tried adding it to position.h but that did not work
Obviously the developer of Stockfish should have done it, but I guess he didn't test it in Linux.
-
- Posts: 536
- Joined: Thu Mar 09, 2006 12:53 am
Re: Stockfish-1.2 compile on Ubuntu - Error
---------------------ilari wrote:It's <cstring>, not <string>. You should put it in position.cpp.royb wrote:Sorry, I don't code in C or C++ or C# -- what file is :
#include <string>
needed in now?
I tried adding it to position.h but that did not work
Obviously the developer of Stockfish should have done it, but I guess he didn't test it in Linux.
That got it! Thanks very much.
Roy
-
- Posts: 287
- Joined: Sat Mar 11, 2006 3:19 am
- Location: Atlanta, GA
Re: Stockfish-1.2 compile on Ubuntu - Error
Indeed, but if you use cstring you must also use the std namespace qualifier or give a using directive. I proposed to just include string.h because it doesn't look like the code calls std::memset() and instead just calls memset().ilari wrote:The .h extension is deprecated in modern C++. One should use #include <cstring> instead.Pradu wrote:Introduce the following line in the pawns.h file at the top of the file:
#include <string.h>
-
- Posts: 750
- Joined: Mon Mar 27, 2006 7:45 pm
- Location: Finland
Re: Stockfish-1.2 compile on Ubuntu - Error
Actually none of the C libraries (including cstring) needs the namespace qualifier. Otherwise Roy's compile would have failedPradu wrote:Indeed, but if you use cstring you must also use the std namespace qualifier or give a using directive. I proposed to just include string.h because it doesn't look like the code calls std::memset() and instead just calls memset().ilari wrote:The .h extension is deprecated in modern C++. One should use #include <cstring> instead.Pradu wrote:Introduce the following line in the pawns.h file at the top of the file:
#include <string.h>