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
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to