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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:10:36+00:00 2026-05-18T09:10:36+00:00

I have this vector. vector<CXFileEntity>* menu;// CXFileEntity is class When i try load an

  • 0

I have this vector.

vector<CXFileEntity>* menu;// CXFileEntity is class

When i try load an x file to it there is a problem.
Here is my code

menu->at(0)=menu->at(0).LoadXFile(CUtility::GetTheCurrentDirectory()+"\\meshes\\Menu\\background.x", 1, menu->at(0), d3dx->d3ddev);
menu->at(1)=menu->at(1).LoadXFile(CUtility::GetTheCurrentDirectory()+"\\meshes\\Menu\\start.x", 1, menu->at(1), d3dx->d3ddev);

I get these errors

Error   1   error C2679: binary '=' : no operator found which takes a right-hand operand of type 'CXFileEntity *' (or there is no acceptable conversion)    c:\users\owner\documents\visual studio 2010\projects\monopoly\monopoly\window.cpp   86

Error   2   error C2664: 'CXFileEntity::LoadXFile' : cannot convert parameter 3 from 'CXFileEntity' to 'CXFileEntity *' c:\users\owner\documents\visual studio 2010\projects\monopoly\monopoly\window.cpp   87

It seems to be that when I’m assigning a pointer to my vector it doesn’t work the error says that CXFileEntity can’t be converted to CXFileEntity* but i assigned it to be a pointer.
So, I tried to change it to.

menu->at(0)=menu->at(0).LoadXFile(CUtility::GetTheCurrentDirectory()+"\\meshes\\Menu\\background.x", 1, &menu->at(0), d3dx->d3ddev);// added &

but now i got this error

Error   2   error C2664: 'CXFileEntity::LoadXFile' : cannot convert parameter 3 from 'CXFileEntity' to 'CXFileEntity *' c:\users\owner\documents\visual studio 2010\projects\monopoly\monopoly\window.cpp   87

I’m so lost with this one..
EDIT 2:
Here is the CXFileEntity class

#pragma once
#include "stdafx.h"
/*
    This class represents an x file animation
    It loads the .x file and carries out the animation update and rendering
*/
class CXFileEntity
{
private:
    LPDIRECT3DDEVICE9 m_d3dDevice; // note: a pointer copy (not a good idea but for simplicities sake)

    // Direct3D objects required for animation
    LPD3DXFRAME                 m_frameRoot;
    LPD3DXANIMATIONCONTROLLER   m_animController;
    D3DXMESHCONTAINER_EXTENDED* m_firstMesh;

    // Bone data
    D3DXMATRIX *m_boneMatrices;
    UINT m_maxBones;

    // Animation variables
    unsigned int m_currentAnimationSet;
    unsigned int m_numAnimationSets;
    unsigned int m_currentTrack;
    float m_currentTime;
    float m_speedAdjust;

    // Bounding sphere (for camera placement)
    D3DXVECTOR3 m_sphereCentre;
    float m_sphereRadius;

    std::string m_filename;

    void UpdateFrameMatrices(const D3DXFRAME *frameBase, const D3DXMATRIX *parentMatrix);
    void UpdateSkinnedMesh(const D3DXFRAME *frameBase);
    void DrawFrame(LPD3DXFRAME frame) const;
    void DrawMeshContainer(LPD3DXMESHCONTAINER meshContainerBase, LPD3DXFRAME frameBase) const;
    void SetupBoneMatrices(D3DXFRAME_EXTENDED *pFrame/*, LPD3DXMATRIX pParentMatrix*/); 
    bool Load(const std::string &filename);
public:
    CXFileEntity(LPDIRECT3DDEVICE9 d3dDevice);
    ~CXFileEntity(void);
    mutable D3DXMATRIX m_combinedMat, * s;
    void CreateRay();
    mutable LPD3DXMESH pDrawMesh;
    bool draw;
    float distanceToCollision;
    BOOL hasHit;

    CXFileEntity* LoadXFile(const std::string &filename,int startAnimation, CXFileEntity *menus, LPDIRECT3DDEVICE9 d3ddev);
    void FrameMove(float elapsedTime,const D3DXMATRIX *matWorld);

    void Render() const;
    void SetAnimationSet(unsigned int index);
    void SetComb(LPDIRECT3DDEVICE9 d3dDevice, D3DXMATRIX world);
    float m_fHitDist;
    CXFileEntity *m_pChild;
    CXFileEntity *m_pSibling;

    void NextAnimation();
    void AnimateFaster();
    void AnimateSlower();

    D3DXVECTOR3 GetInitialCameraPosition() const;
    unsigned int GetCurrentAnimationSet() const {return m_currentAnimationSet;}
    std::string GetAnimationSetName(unsigned int index);
    std::string GetFilename() const {return m_filename;}
};
  • 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-18T09:10:37+00:00Added an answer on May 18, 2026 at 9:10 am

    LoadXFile() seems to be returning a pointer, ie. CXFileEntity * while the vector only accepts objects of CXFileEntity.

    I don’t understand your design. You have instances of CXFileEntity in your std::vector. Then you access those instances and call LoadXFile() on them… which return pointers to CXFileEntity, which you’re trying to store back inside the std::vector?

    Following your own flow,

    You need to use the dereference operator * to obtain access to the actual object that the pointer points to.

    menu->at(0)=*(menu->at(0).LoadXFile(CUtility::GetTheCurrentDirectory()+
    "\\meshes\\Menu\\background.x", 1, &(menu->at(0)), d3dx->d3ddev));
    

    The second error says that you need to pass in a pointer to a CXFileEntity, as you guessed. The problem was operator precedence, so you need to use appropriate parentheses.

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

Sidebar

Related Questions

I have this code here and it works but there has to be a
Suppose I have this (C++ or maybe C) code: vector<int> my_vector; for (int i
IE what happens if you have this following piece of code? int mean(const vector<int>
I have this code: int main() { vector<int> res; res.push_back(1); vector<int>::iterator it = res.begin();
I have a vector that I want to insert into a set . This
I have this code in jQuery, that I want to reimplement with the prototype
I have this idea for a free backup application. The largest problem I need
What if I have this: union{ vector<int> intVec ; vector<float> floatVec ; vector<double> doubleVec
I have a 3D vector defined like this... std::vector<std::vector<std::list<Object*> > > m_objectTiles; I have
So I have this list of ints. It could be a Vector , int[]

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.