Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:46:22+00:00 2026-06-14T09:46:22+00:00

I’m having some trouble with a class that was working fine and now doesn’t

  • 0

I’m having some trouble with a class that was working fine and now doesn’t seem to want to work at all.

The error is "No appropriate default constructor available"

I am using the class in two places I’m making a list of them and initializing then adding them to the list.

Vertice3f.h

#pragma once 
#include "Vector3f.h"

// Vertice3f hold 3 floats for an xyz position and 3 Vector3f's 
//  (which each contain 3 floats) for uv, normal and color

class Vertice3f{
private:
    float x,y,z;
    Vector3f uv, normal, color;

public:
    // If you don't want to use a UV, Normal or Color 
    //  just pass in a Verctor3f with 0,0,0 values
    Vertice3f(float _x, float _y, float _z, Vector3f _uv, 
              Vector3f _normal, Vector3f _color);
    ~Vertice3f();
};

Vertice3f.cpp

#include "Vertice3f.h"

Vertice3f::Vertice3f(float _x, float _y, float _z, 
                     Vector3f _uv, Vector3f _normal, Vector3f _color){
    x = _x;
    y = _y;
    z = _z;
    uv = _uv;
    normal = _normal;
    color = _color;
}

It is being using in my OBJModelLoader class as follows:

list<Vertice3f> vert3fList;

Vertice3f tvert = Vertice3f(
            x = (float)atof(
            vertList[i].substr(
                vertList[i].find("v") + 1,
                vertList[i].find(" ", vertList[i].find("v") + 2, 10)
                ).c_str()
            ),
            y = (float)atof(
                vertList[i].substr(
                    vertList[i].find(" ", vertList[i].find("v") + 4, 10) + 1,
                    vertList[i].find(" ", vertList[i].find("v") + 13, 10)
                ).c_str()
            ),
            z = (float)atof(
                vertList[i].substr(
                vertList[i].find(" ", vertList[i].find("v") + 13, 10) + 1,
                vertList[i].find(" ", vertList[i].find("v") + 23, 10)
                ).c_str()
            ),
            ::Vector3f(0.0f,0.0f,0.0f),::Vector3f(0.0f,0.0f,0.0f),::Vector3f(0.0f,0.0f,0.0f)
        );

        vert3fList.push_back(
            tvert
        );

I have tried defining a default constructor myself so in the .h I put

Vertice3f();

and in the cpp

Vertice3f::Vertice3f(){
x = 0.0f;
y = 0.0f;
z = 0.0f;
uv = Vector3f(0.0f,0.0f,0.0f);
normal = Vector3f(0.0f,0.0f,0.0f);
color = Vector3f(0.0f,0.0f,0.0f);
}

So, I’m not sure why it can’t find a default constructor or how to appease the compiler. I’m sure it’s user error because the compiler probably knows what it’s doing.
Any help is greatly appreciated, I will answer any other questions you have, just ask.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:46:24+00:00Added an answer on June 14, 2026 at 9:46 am

    I’d guess that the missing default constructor is the default constructor of Vector3f class, not of Vertice3f class. Your constructor of Vertice3f attempts to default-construct its Vector3f members, which leads to the error.

    This is why your attempts to provide default constructor for Vertice3f don’t change anything. The problem lies, again, with Vector3f.

    To fix it either provide all necessary default constructors (assuming it agrees with your design), or rewrite the constructor of Vertice3f by using initializer list instead of in-body assignment

    Vertice3f::Vertice3f(float _x, float _y, float _z, 
                         Vector3f _uv, Vector3f _normal, Vector3f _color) :
        x(_x), y(_y), z(_z), uv(_uv), normal(_normal), color(_color)
      {}
    

    This version no longer attempts to default-construct anything. And using initializer list instead of in-body assignment is a good idea in any case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.