Fórum Root.cz

Hlavní témata => Vývoj => Téma založeno: webhope 12. 06. 2014, 23:40:48

Název: Třída pro bitmapu (GDIPlus / Windows)
Přispěvatel: webhope 12. 06. 2014, 23:40:48
Jestli máte někdo zkušenost s Visual Studio C++ 2010 potřeboval bych poradit.

Dostávám tuto chybu:
K řádku:
Kód: [Vybrat]
GpBitmap* pBitmap;error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
a k dalšímu řádku:
Kód: [Vybrat]
HBITMAP bitmap;C2380: type(s) preceding 'bitmap' (constructor with return type, or illegal redefinition of current class-name?)

Oba typy by měly být známé, protože v jiném programu kde to používám (ale mimo třídu, v hlavní funkci main) to funguje. Takže gdiplus mám includovaný i windows mám includocaný kvůli HBITMAP.

Kód: [Vybrat]
#include "stdafx.h"

#include "filework.h" // GetEncoderClsid
#include <windows.h> // HBITMAP needs this
#include <gdiplus.h> // GdipSaveImageToFile needs this

#include <string>
#include <vector>
#include <iostream>

#include <cstdio>
#include <fstream>
#include <tchar.h>

using namespace std;


class bitmap {
    private:
   int result;
   GpBitmap* pBitmap;
   HBITMAP bitmap;
   void printError(int Bitmap::result){
   cout << "Error:" . result << "\n";
    }
public:
bool saveFile(GpBitmap *pBitmap, string *pFilename){
result = Gdiplus::DllExports::GdipSaveImageToFile(bitmap::pBitmap, bitmap::pFilename, &pngClsid, NULL);
if (result != 0)
printError(result);
};
};
Název: Re:Třída pro bitmapu (GDIPlus / Windows)
Přispěvatel: webhope 13. 06. 2014, 07:42:57
Mám to vyřešeno.
Název: Re:Třída pro bitmapu (GDIPlus / Windows)
Přispěvatel: JmJ 13. 06. 2014, 07:55:25
Mám to vyřešeno.
Uzasne. Mozna by budouci generace ocenily, kdybys napsal, jak si to vyresil...
Název: Re:Třída pro bitmapu (GDIPlus / Windows)
Přispěvatel: webhope 14. 06. 2014, 08:20:52
JmJ, možná. Ale budu ještě přidělávat další metody k té bitmapě takže ještě to není kompletní. Ta hláška znamenala, že nemůže najít daný typ. Typ je uvedený v knihovně gdiplus. Tak6e je třeba použít namespace nebo přistoupit k typu přes ::