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 8408781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:43:31+00:00 2026-06-09T23:43:31+00:00

I have a piece of code and some errors and warnings, I could not

  • 0

I have a piece of code and some errors and warnings, I could not understand why they occur. Could you give me your advice?

The first:

#pragma once

#include "Vector3.h"
#include <vector>

#include <GL/glew.h>

class BoundingSphere
{
public:
    float radius;
    Vector3 center;
    BoundingSphere(float radius, Vector3 center) : radius(radius),center(center) {};
    BoundingSphere() {};
};

class TriangleFace;

class MeshVertex
{

private:
    Vector3 position; 
    std::vector<TriangleFace *> faces;
    Vector3 normal;
    bool normalUpdateNeeded;

public:

    unsigned int index;

    MeshVertex(void);
    MeshVertex(Vector3 position);
    ~MeshVertex(void);

    Vector3 &getPos() {return position;};
    void addFace(TriangleFace *face);
    const std::vector<TriangleFace*>& getFaces() {return faces;  };
    Vector3 getNormal();

    void setPos(Vector3 & pos) {position = pos; }
    bool isSurfaceParticle() {return faces.size()>0;}
    void updateNormal();
};

class TriangleFace
{
private:
    Vector3 normal;
    bool normalUpdateNeeded;

public:
    MeshVertex* particles[3];
    TriangleFace(void);
    TriangleFace(MeshVertex *p1, MeshVertex *p2, MeshVertex *p3);
    MeshVertex& operator[](int i) {  return *(particles[i]); }
    Vector3 getNormal();
    ~TriangleFace(void);
    void updateNormal();
};

class TriangleMesh
{
protected:
    std::vector<MeshVertex> particles;
    std::vector<TriangleFace> faces;

public:
    TriangleMesh(string filename);
    ~TriangleMesh(void);

    void reserveNumberOfFaces(unsigned int n) { faces.reserve(n); };
    void addFace(TriangleFace &f) {faces.push_back(f);};
    void addFace(MeshVertex *p1, MeshVertex *p2, MeshVertex *p3) {faces.push_back(TriangleFace(p1,p2,p3));};

    std::vector<TriangleFace>& getFaces() {return faces;};
    std::vector<MeshVertex>& getParticles() { return particles; };

    void updateNormals();

    BoundingSphere getBoundingSphere();
};


class RenderTriangleMesh
{
private: 
    TriangleMesh &m;

    GLuint vboid[2];

    GLfloat *vertices;
    GLfloat *normals;

public:
    RenderTriangleMesh(TriangleMesh &m);
    void draw();

private:
    void generateVBOs();
    void updateVBOs();

};

Errors:

error C2220: warning treated as error – no ‘object’ file generated

warning C4512: ‘RenderTriangleMesh’ : assignment operator could not be generated

And the other:

 virtual short SimpleAddOK(const GeneralMatrix* gm) { return 0; }

error :

error C2220: warning treated as error – no ‘object’ file generated

warning C4100: ‘gm’ : unreferenced formal parameter

  • 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-09T23:43:32+00:00Added an answer on June 9, 2026 at 11:43 pm

    The first is saying that the compiler could not generate an assignment operator. This happens because of your reference member, as references cannot be reseated:

    struct foo
    {
        int& i;
    };
    
    int x, y;
    foo f = { x };
    foo g = { y };
    
    f = g; // ??? 
    

    You can silence the warning by explicitly disabling it yourself:

    struct foo
    {
        int& i;
    
    private:
        foo& operator=(const foo&); // declared but never defined
    };
    

    That’s an old trick to make the assignment operator unusable, but stops the compiler from generating it.

    In C++11, you can do this:

    struct foo
    {
        int& i;
    
    private:
        foo& operator=(const foo&) = delete;
    };
    

    which is more explicit and much less hacky.


    The other is because you never used your argument, which can often be an error in program logic. You should probably remove its name if you don’t use it:

    virtual short SimpleAddOK(const GeneralMatrix* /* gm */) { return 0; } 
    

    Personally I delete it completely. Others do this:

    virtual short SimpleAddOK(const GeneralMatrix* gm)
    {
        (void)gm; // this "uses" gm
    
        return 0;
    } 
    

    It’s sometimes wrapped in a macro called USE:

    #define USE(x) (void)x
    
    virtual short SimpleAddOK(const GeneralMatrix* gm)
    {
        USE(gm);
    
        return 0;
    } 
    

    I consider these inferior to simply deleting the name, because if the warning is actually correct (that is, you do have a flaw in your program and aren’t seeing it), you’re masking the warning, defeating the purpose.

    Warnings should always be fixed, not silenced.

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

Sidebar

Related Questions

If have a piece of code that gets some data from a sql database
I have the following piece of code that takes in some words, stores them
I am reading some book and I have encountered a piece of code that
I have got a piece of code, that should countdown some number (in this
I have a Login.aspx page, and I wanna incude some piece of code in
I have a piece of code which combines an in-memory list with some data
I have a piece of code that originally used CString. Since it is not
I have this piece of code which I am using to update some values
Here I have piece of code, showing example of how I want to update
I have a piece of code like this: <div id=container runat=server> <div id=parent runat=server>

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.