Einzelnen Beitrag anzeigen

Benutzerbild von Desmulator
Desmulator

Registriert seit: 3. Mai 2007
Ort: Bonn
169 Beiträge
 
#7

Re: Delphi's Interfaces in C++

  Alt 1. Jun 2009, 11:04
Okay.

Code:
class IBaseInterface: public IUnknown
{
    virtual __stdcall void* GetHandle() = 0;
};

extern "C" {
    ...
    IBaseInterface BaseCreateFileInfo(char* FileName, bool Extended);
}
Zitat:
Compiler: Default compiler
Building Makefile: "C:\Dokumente und Einstellungen\Lars\Desktop\BaseCTest\Makefile.win"
Führt make... aus
make.exe -f "C:\Dokumente und Einstellungen\Lars\Desktop\BaseCTest\Makefile.win" all
g++.exe -D__DEBUG__ -c main.cpp -o main.o -I"C:/Programme/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Programme/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Programme/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Programme/Dev-Cpp/include/c++/3.4.2" -I"C:/Programme/Dev-Cpp/include" -I"C:/Dokumente und Einstellungen/Lars/Desktop/BaseCTest" -pg -g3

In file included from main.cpp:2:
C:/Dokumente und Einstellungen/Lars/Desktop/BaseCTest/baseEngine.h:91: error: invalid return type for function `IBaseInterface BaseCreateFileInfo(char*, bool)'
C:/Dokumente und Einstellungen/Lars/Desktop/BaseCTest/baseEngine.h:91: error: because the following virtual functions are abstract:
C:/Programme/Dev-Cpp/include/unknwn.h:27: error: virtual HRESULT IUnknown::QueryInterface(const IID&, void**)
C:/Programme/Dev-Cpp/include/unknwn.h:28: error: virtual ULONG IUnknown::AddRef()
C:/Programme/Dev-Cpp/include/unknwn.h:29: error: virtual ULONG IUnknown::Release()
C:/Dokumente und Einstellungen/Lars/Desktop/BaseCTest/baseEngine.h:74: error: virtual void* IBaseInterface::GetHandle()

main.cpp: In function `int main(int, char**)':

main.cpp:15: error: cannot allocate an object of type `IBaseInterface'
main.cpp:15: error: since type `IBaseInterface' has abstract virtual functions
main.cpp:15: error: cannot allocate an object of type `IBaseInterface'
main.cpp:15: error: since type `IBaseInterface' has abstract virtual functions
main.cpp:15: error: cannot declare variable `Face' to be of type `IBaseInterface'
main.cpp:15: error: since type `IBaseInterface' has abstract virtual functions
Selbst wenn ich das class durch ein interface ersetze bleibt der fehler.
Lars
There are 10 kinds of people in the world:
those who get binary, and those who don’t.
  Mit Zitat antworten Zitat