Hej ng.
Jeg kan ikke gennemskue hvad g++ klager over i denne her kode:
---------------
Her er headeren:
---------------
#ifndef _BITSTREAM_
#define _BITSTREAM_
#include <list>
#include <stdio.h>
#ifdef __linux__
class exception { };
#include <pthread.h>
#endif
class BitStream
{
private:
#ifdef __linux__
struct LinuxEvent
{
pthread_mutex_t wait_mutex;
pthread_cond_t condition;
};
#endif
#ifdef __linux__
void _create_event ( BitStream::LinuxEvent &event );
#endif
};
#endif
--------------------
Og her er sourcefilen:
----------------------
#include "BitStream.h"
#include <assert.h>
#define BLOCKSIZE 262144 // 1 mb. in dwords
#define BLOCKSIZE_BYTES 1048576 // 1 mb.
#define CACHE_BUFFERCOUNT 4
BitStream::BitStream ()
{
};
BitStream:
BitStream ()
{
};
//----------//
// Privates //
//----------//
#ifdef __linux__
void BitStream::_create_event ( BitStream::LinuxEvent &event )
{
event.condition = PTHREAD_COND_INITIALIZER;
event.wait_mutex = PTHREAD_MUTEX_INITIALIZER;
};
#endif
----------------------
Her er output fra make:
-----------------------
g++ -c -o BitStream.o BitStream.cpp
BitStream.cpp: In member function `void
BitStream::_create_event(BitStream::LinuxEvent&)':
BitStream.cpp:30: error: parse error before `{' token
BitStream.cpp: At global scope:
BitStream.cpp:31: error: syntax error before `.' token
make: *** [BitStream.o] Error 1
Linje 30 er "event.condition = PTHREAD....."
Hvad er der galt?
mvh.
Klaus