Page 1 of 1

Compilation error: ‘strlen’ was not declared in this scope

Posted: Fri Dec 05, 2008 5:44 am
by qubodup
I finally compiled LOVE on this 64-bit Arch Linux system I'm using now and I had one minor problem:

Code: Select all

physfs/File.cpp: In member function ‘virtual bool love_physfs::File::write(const char*, int)’:
physfs/File.cpp:112: error: ‘strlen’ was not declared in this scope
make[2]: *** [physfs/File.o] Error 1
I added #include <stdio.h> and #include <string.h> to the file physfs/File.cpp, and then compilation worked.

I had a similar problem with box2d, only with much more files, not just one as in LOVE's case.

I'm not sure what the reason is, but think that it's the stricter rules of some newer gcc or g+ version.

Thought I'd let you know.

ATTENTION FORUM ADMIN: if I replace "g+" with "g++" this post will not let me submit this post. Whaat?

Re: Compilation error: ‘strlen’ was not declared in this scope

Posted: Sun Dec 07, 2008 12:43 pm
by wicketh
I had this problem installing clanlib and i don't know if my solution is any good in this situation, but doing

Code: Select all

#include <string>
in the the file where strlen wasn't declared seemed to work. I found it odd that this lib was used in other source-files and still wasn't declared in this scope, but wtf..