From: Roy S. <roy...@ic...> - 2009-12-17 17:03:24
|
On Thu, 17 Dec 2009, David Knezevic wrote: > I just svn upped and I got a bunch of compilation errors with the new > getpot.h, e.g. > > In file included from src/base/libmesh.C:29: > libmesh/include/base/getpot.h: In member function ‘const char* > GetPot::__internal_managed_copy(const std::string&) const’: > libmesh/include/base/getpot.h:883: error: ‘strncpy’ was not declared in > this scope > > Changing #include <string> to #include <string.h> fixed it for me. Getting rid of #include <string> isn't a good thing - we use std::string all over that file and we don't want to assume that we've already got <string> included from some previous header. (even though it's practically certain to come in through sstream) And how on earth did we avoid getting strncpy defined through #include <cstring>? The whole point of those headers is supposed to be that <cblah> is equivalent to <blah.h> except that <blah.h> isn't guaranteed to be C++ compatible. Can you get the same behavior from a simple test case? #include <cstring> int main(void) { strncpy(NULL, NULL, 0); } That ought to compile, at least. What compiler version are you using? --- Roy |