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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

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

Post 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?
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
User avatar
wicketh
Prole
Posts: 3
Joined: Mon Dec 01, 2008 6:41 pm

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

Post 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..
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 25 guests