Note that there are some explanatory texts on larger screens.

plurals
  1. POInterface not recognized
    primarykey
    data
    text
    <p>I have an interface declared in its own header MyInterface.h:</p> <pre><code>class MyInterface{ public: virtual ~MyInterface(){} virtual void initialize() = 0; virtual void newValueSound(int stream, double value) = 0; virtual void newValueAlg1(int stream, double value) = 0; virtual void newValueAlg2(int stream, double value) = 0; }; </code></pre> <p>Whenever I include this header and try to use the interface, for example:</p> <pre><code>#include "MyInterface.h" void someMethod(){ MyInterface *interface; } </code></pre> <p>I get strange compile errors on the line:</p> <p>error C2332: 'struct' : missing tag name<br> error C2011: '&lt;unnamed-tag>' : 'enum' type redefinition<br> error C2226: syntax error : unexpected type '&lt;unnamed-tag>' </p> <p>What is wrong with my code?</p> <p>EDIT: Header has include guards. I use Eclipse CDT with Microsoft compiler.</p> <p>The whole header:</p> <pre><code>#ifndef MYINTERFACE_H_ #define MYINTERFACE_H_ class MyInterface{ public: virtual ~MyInterface(){} virtual void initialize() = 0; virtual void newValueSound(int stream, double value) = 0; virtual void newValueAlg1(int stream, double value) = 0; virtual void newValueAlg2(int stream, double value) = 0; }; #endif </code></pre> <p>and the class it is used in:</p> <pre><code>#ifndef MAIN_H_ #define MAIN_H_ #include &lt;asio.h&gt; #include "Stream.h" #include "MyInterface.h" class MicApp { private: long inputChannelCount; Stream **streams; MyInterface *interface; public: MicApp(MyInterface *interface); void initializeASIODrivers(); char **getDriverNames(int *numberOfDrivers); bool loadDriver(char *driverName); ASIOError initDriver(ASIODriverInfo *asioDriverInfo); long getChannelCount(); double getSampleRate(); void activateStream(bool activate, int stream); ASIOError startASIO(); ASIOError stopASIO(); ASIOError exitDriver(); }; #endif </code></pre> <p>Note that "Stream" is another class and it is used without any problems.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload