problem compiling static library
I am trying to build a static library. I am having a problem when I try
to compile it. I am getting two errors. The first is at line 82 and the
second is at line 120. Both errors seem to be related to the same thing,
namely 'memset was not declared in this scope'
It is a very long file so I have posted only the section of the file up
to the first error as the second error further down seems to be similar.
------------------------------------------------------------------
// This is a X Window/Posix implementation of the playpen interface.
//
// Author: Jean-Marc Bourguet
//
// This file shares part of the implementation with the MS Windows one by
// copying the code. A better way would be to separate platform-specific
// and platform-independent code into different translation units.
// However, this would complicate the build steps and considering the code
// is intended to be used (if not understood) by novices, this has not been
// done.
// Implemented interface
#include "keyboard.h"
#include "mouse.h"
#include "playpen.h"
// C++ standard headers
#include <assert.h>
#include <map>
#include <stdexcept>
#include <stdlib.h>
#include <streambuf>
// Posix headers
#include <pthread.h>
#include <sys/time.h>
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
// X Window headers
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
namespace
{
using namespace studentgraphics;
int const key_unknown = 0xFE;
//
======================================================================
// Platform-independant utility classes
//
======================================================================
//
**********************************************************************
// Inherit privately from this class to disable copy constructor and
// assignment operator
class CopyDisabler
{
public:
CopyDisabler();
private:
CopyDisabler(CopyDisabler const&);
CopyDisabler& operator=(CopyDisabler const&);
};
inline
CopyDisabler::CopyDisabler()
{
}
//
**********************************************************************
// The mapping between hue and RGB value
struct HueRGB256
{
HueRGB rgbs[colours];
HueRGB256();
};
HueRGB256::HueRGB256()
{
memset(rgbs, 0, sizeof(HueRGB) * colours);
-----------------------------
The compiler errors are as follows:
||=== Build: Release in fgw (compiler: GNU GCC Compiler) ===|
/home/n/tutorial/source/playpen_unix1.cpp||In constructor
?{anonymous}::HueRGB256::HueRGB256()?:|
/home/n/tutorial/source/playpen_unix1.cpp|82|error: ?memset? was not
declared in this scope|
/home/n/tutorial/source/playpen_unix1.cpp||In member function ?void
{anonymous}::Pixels::Clear(studentgraphics::hue)?:|
/home/n/tutorial/source/playpen_unix1.cpp|120|error: ?memset? was not
declared in this scope|
/home/n/tutorial/source/playpen_unix1.cpp||In member function ?void*
{anonymous}::SingletonWindowImpl::WorkerThread()?:|
/home/n/tutorial/source/playpen_unix1.cpp|685|warning: suggest
parentheses around comparison in operand of ?&? [-Wparentheses]|
/home/n/tutorial/source/playpen_unix1.cpp|330|warning:
?{anonymous}::SingletonWindowImpl::instance_? defined but not used
[-Wunused-variable]|
||=== Build failed: 2 error(s), 2 warning(s) (0 minute(s), 11 second(s))
===|
--------------------------------
So both errors relate to 'memset' not being declared. Can anyone see how
I can correct this?
Thanks