How to fix these compiler errors?

Posted by Sandra Schlichting on Stack Overflow See other posts from Stack Overflow or by Sandra Schlichting
Published on 2010-04-03T14:07:16Z Indexed on 2010/04/03 14:13 UTC
Read the original article Hit count: 699

Filed under:

I have this source code from 2001 that I would like to compile.

It gives this:

$ make
g++ -O99 -Wall -DLINUX -pedantic   -c -o audio.o audio.cpp
In file included from audio.cpp:7:
audio.h:14: error: use of enum ‘mad_flow’ without previous declaration
audio.h:15: error: use of enum ‘mad_flow’ without previous declaration
audio.h:17: error: use of enum ‘mad_flow’ without previous declaration
audio.cpp: In function ‘mad_flow audio::input(void*, mad_stream*)’:
audio.cpp:19: error: new declaration ‘mad_flow audio::input(void*, mad_stream*)’
audio.h:14: error: ambiguates old declaration ‘int audio::input(void*, mad_stream*)’
audio.h:11: error: ‘size_t audio::stream::BufferPos’ is private
audio.cpp:23: error: within this context
audio.h:11: error: ‘size_t audio::stream::BufferSize’ is private
audio.cpp:23: error: within this context
audio.h:10: error: ‘char* audio::stream::Buffer’ is private
audio.cpp:26: error: within this context
audio.h:11: error: ‘size_t audio::stream::BufferSize’ is private
audio.cpp:26: error: within this context
audio.h:11: error: ‘size_t audio::stream::BufferPos’ is private
audio.cpp:27: error: within this context
audio.h:11: error: ‘size_t audio::stream::BufferSize’ is private
audio.cpp:27: error: within this context
audio.cpp: In function ‘mad_flow audio::output(void*, const mad_header*, mad_pcm*)’:
audio.cpp:49: error: new declaration ‘mad_flow audio::output(void*, const mad_header*, mad_pcm*)’
audio.h:15: error: ambiguates old declaration ‘int audio::output(void*, const mad_header*, mad_pcm*)’
audio.cpp: In function ‘mad_flow audio::error(void*, mad_stream*, mad_frame*)’:
audio.cpp:83: error: new declaration ‘mad_flow audio::error(void*, mad_stream*, mad_frame*)’
audio.h:17: error: ambiguates old declaration ‘int audio::error(void*, mad_stream*, mad_frame*)’
audio.cpp: In constructor ‘audio::stream::stream(const char*)’:
audio.cpp:119: error: ‘input’ was not declared in this scope
audio.cpp:122: error: ‘output’ was not declared in this scope
audio.cpp:123: error: ‘error’ was not declared in this scope
make: *** [audio.o] Error 1

audio.h contains

#include <stdlib.h>
#include "mad.h"

namespace audio {
  class stream {
  private:
    char* Buffer;
    size_t BufferSize, BufferPos;
    struct mad_decoder Decoder;

    friend enum mad_flow input(void* Data, struct mad_stream* MadStream);
    friend enum mad_flow output(void* Data, const struct mad_header* Header,
                struct mad_pcm* PCM);
    friend enum mad_flow error(void* Data, struct mad_stream* MadStream,
                   struct mad_frame* Frame);

  public:
    stream(const char* FileName);
    ~stream();

    void play();
  };
}

I have tried to just insert

enum mad_flow {};

but that just gave a new problem.

Can anyone see how to fix this?

© Stack Overflow or respective owner

Related posts about c++