Error C2512 no appropriate default constructor available

I’m trying to do instantiate a new object from custom class, but when I’m compilling i get these error :

error C2512 no appropriate default constructor available

this what I want to do :

UQuizQuestion *UquizAPI::getQuestion() {
	UQuizQuestion *question = new UQuizQuestion();

	return question;

and this is my Question class :
#include “quizMobile.h”
#include “QuizQuestion.h”

UQuizQuestion::UQuizQuestion(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
	this->nbAnswers = 0;

FString				UQuizQuestion::getQuestion(){
	return this->_question;

TArray<FString>		UQuizQuestion::getAnswers(){
	return this->_answer;

void				UQuizQuestion::setQuestion(FString question){
	this->_question = question;

void				UQuizQuestion::setAnswers(TArray<FString> answers) {
	this->_answer = answers;
	this->nbAnswers = answers.Num();

void				UQuizQuestion::addAnswer(FString answer){

and the Header :

#pragma once

#include "Object.h"
#include "QuizQuestion.generated.h"

class UQuizQuestion : public UObject

	FString				_question;
	TArray<FString>		_answer;
	int					nbAnswers;

	UFUNCTION(BlueprintCallable, Category = "Quiz API")
	FString				getQuestion();
	void				setQuestion(FString question);

	UFUNCTION(BlueprintCallable, Category = "Quiz API")
	TArray<FString>		getAnswers();
	void				setAnswers(TArray<FString> answers);
	void				addAnswer(FString answer);

I just got this same error a few minutes ago. This the solution I found. Here is how you have to instantiate objects derived from UObject:

UQuizQuestion *question = UQuizQuestion::StaticClass()->GetDefaultObject<UQuizQuestion>();

I also resolve it with that :

UQuizQuestion *question = new UQuizQuestion(FPostConstructInitializeProperties::FPostConstructInitializeProperties());

The easiest correct way to allocate a new instance of a UObject is to use NewObject:

UQuizQuestion* NewQuestion = NewObject<UQuizQuestion>();

This will ensure your object is created in the right package and set up correctly. There’s some information about UObject creation here.

Please note that this is accessing the default object for the class UQuizQuestion, not creating a new instance of it.

I got this error as well, except I wasn’t trying to create a new object. My solution was putting the following:

 : Super(ObjectInitializer)

after the constructor of a child class whose parent class constructor used FObjectInitializer as a parameter.