Mitglied "..." ist kein Typname, Konstruktor-Definition (in .cpp) nimmt Struktur nicht als Eingabevariable [geschlossen]C++

Programme in C++. Entwicklerforum
Anonymous
 Mitglied "..." ist kein Typname, Konstruktor-Definition (in .cpp) nimmt Struktur nicht als Eingabevariable [geschlossen]

Post by Anonymous »

Ich versuche, einen UI-Code zu schreiben (zum Lernzwecken) und ich erhalte diesen Fehler, für den ich keine Fix finden kann.

Code: Select all

`E0493` No instance of overloaded function "UIElement::UIElement" matches the given argument type
`E0757` "Member "UIElement::UIState" " is not a typename
`C2061` Syntaxerror: Type "UIState"
`C2511` UIElement::UIElement(uint16_t): Overloaded memberfunction not found in "UIElement"
< /code>
Grundsätzlich habe ich diese Klasse uielement.h < /code> und [url=viewtopic.php?t=14917]ich möchte[/url] einen Konstruktor dafür erstellen.
(glm.hpp
ist gemäß ihrer Selbstdokumentation "der Kern von GLM, der genau und nur die GLSL-Spezifikation so implementiert.")

Code: Select all

#pragma once

#include 
#include 
#include 
#include 

class UIElement
{
public:
struct UIState {
bool enabled = false;
bool visible = false;
};

UIElement(
uint16_t UIID_in,
UIState UIState_in,
glm::ivec2 UIPos_in,
glm::ivec2 UISize_in,
uint16_t UILayer_in,
void* UIAnimation_in);
~UIElement();

bool importFromXML();

bool onHover();
bool onClick();

virtual std::string getUIType();

void scale();
void render();

uint16_t UIID;

UIState UIState;

glm::ivec2 UIPosition;
glm::ivec2 UISize;
uint16_t UILayer;

std::vector animation;  // (normal, disabled, hover, click)
};
In Uielement.cpp Ich habe diesen Code:

Code: Select all

#include "UIElement.h"

#include 

UIElement::UIElement(uint16_t UIID_in, UIElement::UIState UIState_in, glm::ivec2 UIPos_in, glm::ivec2 UISize_in, uint16_t UILayer_in, void* UIAnimation_in)
{

}

UIElement::~UIElement()
{

}

bool UIElement::importFromXML()
{
return false;
}

bool UIElement::onHover()
{
return false;
}

bool UIElement::onClick()
{
return false;
}

std::string UIElement::getUIType()
{
throw std::logic_error(std::string("[UI] Virtual UI-Element with ID: " + this->UIID));
return std::string("Virtual UIType");
}

void UIElement::scale()
{

}

void UIElement::render()
{
if (this->UIState.visible == true)
{
// Render
}
}

< /code>
Der Fehler tritt in der .cpp -Datei in der Definition des Konstruktors auf.
Ich weiß nicht, was ich falsch mache. Ich hatte noch nie ein solches Problem. (Auch verdächtig ist, dass ich einen SyntaxEerror C2061 
für uistate )
Ich hatte erwartet, dass der Konstruktor den Uistate uistate_in als Typ für ein in_varaible nimmt. Die Fehler entweder das in_Variable oder der Konstruktor selbst.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post