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

  • Home
  • SEARCH
  • 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 6961253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:30:25+00:00 2026-05-27T15:30:25+00:00

I have the following problem: This error appeared to me, when I compiled the

  • 0

I have the following problem: This error appeared to me, when I compiled the source code:

error C4430: missing type specifier - int assumed

This error occurs when a variable is not initialized with any type (like a integer, float or any custom type of object). But, I have a type initialized and it’s not recognizable, although I have more classes, which are similarly built like the trouble one, and they’re running fine.

So, my problematic class is the following one:

class Rectangle
{
    float x1, y1, x2, y2;
    bool created;

public:
    Rectangle() { created = false;}
    Rectangle(float x1, float y1, float x2, float y2);
    ~Rectangle() {}
    bool isCreated() { return created;}
    void setCreated( bool c) { created = c;}
    float getX1() { return x1;}
    float getX2() { return x2;}
    float getY1() { return y1;}
    float getY2() { return y2;}
};

An example of a working class:

class Triangle
{
private:
    vector<float> x, y, z;
    bool created;

public:
    Triangle() { created = false;}
    Triangle(vector<float> x, vector<float> y, vector<float> z);
    ~Triangle() {}
    bool isCreated() { return created;}
    void setCreated( bool c) { created = c;}
    vector<float> getX() { return x;}
    vector<float> getY() { return y;}
    vector<float> getZ() { return z;}
};

Finally, the code fragment where the errors occur:

class Primitive
{
private:
    string index;
    Material mat;
    Texture text;
    int count;
    Rectangle rect; //error detected in this line
    Triangle tri;
    Cylinder cyl;
    Sphere sph;
    Torus tor;

public:
    Primitive() {count = 0;}
    Primitive(string id, Material mt, Texture tx);
    ~Primitive(void);
    string getIndex() { return index;}
    Material getMaterial() { return mat;}
    Texture getTexture() { return text;}
    void addRectangle(float x1, float y1, float x2, float y2);     //error detected in this line
    Rectangle getRectangle() { if(rect.isCreated()) return rect; else return Rectangle(); }   //error detected in this line
    void addTriangle(float x1, float x2, float x3, float y1, float y2, float y3, float z1, float z2, float z3);
    Triangle getTriangle() { if(tri.isCreated()) return tri; else return Triangle(); }
    void addCylinder(float bs, float tp, float hei, int sli, int stac);
    Cylinder getCylinder() { if(cyl.isCreated()) return cyl; else return Cylinder(); }
    void addSphere(float rad, int sli, int stac);
    Sphere getSphere() { if(sph.isCreated()) return sph; else return Sphere(); }
    void addTorus(float in, float out, int sli, int loo);
    Torus getTorus() { if(tor.isCreated()) return tor; else return Torus(); }
};

Any ideas about how to correct it?

EDIT: My includes are:

#include "Material.h" //custom class
#include "Texture.h"  //custom class
#include <iostream>

The compiler is Visual C++ 2010.

  • 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-05-27T15:30:26+00:00Added an answer on May 27, 2026 at 3:30 pm

    Aside from a really bad design, there are no actual errors in the code you’ve shown. My guess is that the error is in code you haven’t shown us.

    My personal guess is that either Rectangle or rect somehow don’t mean what you expect them to mean at the point you’re using them. Perhaps someone has been playing tricks with the preprocessor.

    I’m absolutely certain that there is no erroneous code of any kind in what you’ve presented here. I’ve edited your code lightly, and it compiles perfectly:

    #include <string>
    #include <vector>
    
    class Rectangle
    {
        float x1, y1, x2, y2;
        bool created;
    
    public:
        Rectangle() { created = false;}
        Rectangle(float x1, float y1, float x2, float y2);
        ~Rectangle() {}
        bool isCreated() { return created;}
        void setCreated( bool c) { created = c;}
        float getX1() { return x1;}
        float getX2() { return x2;}
        float getY1() { return y1;}
        float getY2() { return y2;}
    };
    
    class Triangle
    {
    private:
        ::std::vector<float> x, y, z;
        bool created;
    
    public:
        Triangle() { created = false;}
        Triangle(::std::vector<float> x, ::std::vector<float> y, ::std::vector<float> z);
        ~Triangle() {}
        bool isCreated() { return created;}
        void setCreated( bool c) { created = c;}
        ::std::vector<float> getX() { return x;}
        ::std::vector<float> getY() { return y;}
        ::std::vector<float> getZ() { return z;}
    };
    
    class Primitive
    {
    private:
        ::std::string index;
    //    Material mat;
    //    Texture text;
        int count;
        Rectangle rect; //error detected in this line
        Triangle tri;
    //    Cylinder cyl;
    //    Sphere sph;
    //    Torus tor;
    
    public:
        Primitive() {count = 0;}
    //    Primitive(::std::string id, Material mt, Texture tx);
        ~Primitive(void);
        ::std::string getIndex() { return index;}
    //    Material getMaterial() { return mat;}
    //    Texture getTexture() { return text;}
        void addRectangle(float x1, float y1, float x2, float y2);     //error detected in this line
        Rectangle getRectangle() { if(rect.isCreated()) return rect; else return Rectangle(); }   //error detected in this line
        void addTriangle(float x1, float x2, float x3, float y1, float y2, float y3, float z1, float z2, float z3);
        Triangle getTriangle() { if(tri.isCreated()) return tri; else return Triangle(); }
    //    void addCylinder(float bs, float tp, float hei, int sli, int stac);
    //    Cylinder getCylinder() { if(cyl.isCreated()) return cyl; else return Cylinder(); }
    //    void addSphere(float rad, int sli, int stac);
    //    Sphere getSphere() { if(sph.isCreated()) return sph; else return Sphere(); }
    //    void addTorus(float in, float out, int sli, int loo);
    //    Torus getTorus() { if(tor.isCreated()) return tor; else return Torus(); }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a code review question more then anything. I have the following problem:
Never thought I'd have this problem :) The following snippet of code works in
Never ran into this problem with jQuery before. I have the following: $(document).ready(function() {
I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
I have following problem, Code: String a=Yeahh, I have no a idea what's happening
I have the following problem: I have an HTML textbox ( <input type=text> )
I have written the following mergesort code. public class mergesort { public static int
I have this error when i perform the following task, results = db1.executeSelectCommand(siteSql, (),)
I am getting this error on code that used to work. I have not
I have following code int wordLenght = 256, arrayLength = 2, i = 0,

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.