Click here to Skip to main content
15,911,786 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: A question on c++ template Pin
Rajkumar R6-Jun-07 0:02
Rajkumar R6-Jun-07 0:02 
GeneralRe: A question on c++ template Pin
Cedric Moonen6-Jun-07 0:59
Cedric Moonen6-Jun-07 0:59 
AnswerRe: A question on c++ template Pin
Rajkumar R6-Jun-07 1:25
Rajkumar R6-Jun-07 1:25 
GeneralRe: A question on c++ template Pin
Cedric Moonen6-Jun-07 1:39
Cedric Moonen6-Jun-07 1:39 
GeneralRe: A question on c++ template Pin
Rajkumar R6-Jun-07 1:50
Rajkumar R6-Jun-07 1:50 
QuestionHow i create folder in C++? Pin
Immunity185-Jun-07 14:14
Immunity185-Jun-07 14:14 
AnswerRe: How i create folder in C++? Pin
Mark Salsbery5-Jun-07 14:21
Mark Salsbery5-Jun-07 14:21 
QuestionCode worked in visual studio 6, not working in visual c++ 2005 Pin
Kataric5-Jun-07 14:09
Kataric5-Jun-07 14:09 
Hey guys, I have a line of code here that I am just stumped on.
All of my code for this project worked when compiled under VC++6.0 pro.
For some reason, creating of a new project and inclusion of the .cpp and .h files isn't enough to make it work on visual c++ 2005 (express).


Here is the line

magiitr = &Player1.Magi[mage1];


magiitr is defined as:

vector <Mage>::iterator magiitr;


Player1 is defined globally as:
player Player1;

It is a class of my own design.

Player1.Magi is of type std::vector<mage> player::Magi .

Player1.Magi[mage1] is an array. mage1 is an int.
So this is calling the instance of the mage class in Player1.Magi[1] assuming mage1 equates to 1.

I get a compiler error of c:\nehe\magi\magination\magination.cpp(857) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Mage *__w64 ' (or there is no acceptable conversion)

If I remove the & and make it
magiitr = Player1.Magi[mage1];

I get the error:
c:\nehe\magi\magination\magination.cpp(857) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Mage' (or there is no acceptable conversion)


If I rewrite it to:
*magiitr = Player1.Magi[mage1];

I do not get any compiler errors anymore, but I'm worried about segmentation faults. The code is still broken at this point to determine if this fixed it, but it's nice that I'm not getting any compiler errors.

I'd like to know why a simple change of &Player to *magiitr would change anything. magiitr=&Player sets the magiitr's value to the address of the player1.magi array.

*magiitr = Player1.Magi[mage1] sets the derefereced case of magiitr to the data stored in Player1.Magi[mage1]. I think.

The real kicker is that this worked once, but not now. Any ideas?
AnswerRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Christian Graus5-Jun-07 14:29
protectorChristian Graus5-Jun-07 14:29 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Kataric5-Jun-07 14:36
Kataric5-Jun-07 14:36 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Stephen Hewitt5-Jun-07 15:06
Stephen Hewitt5-Jun-07 15:06 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Kataric5-Jun-07 15:58
Kataric5-Jun-07 15:58 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Stephen Hewitt5-Jun-07 16:01
Stephen Hewitt5-Jun-07 16:01 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Kataric5-Jun-07 16:49
Kataric5-Jun-07 16:49 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Stephen Hewitt5-Jun-07 18:02
Stephen Hewitt5-Jun-07 18:02 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
David Crow6-Jun-07 2:24
David Crow6-Jun-07 2:24 
AnswerRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Steve Echols5-Jun-07 17:21
Steve Echols5-Jun-07 17:21 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Kataric5-Jun-07 21:28
Kataric5-Jun-07 21:28 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Kataric6-Jun-07 10:35
Kataric6-Jun-07 10:35 
GeneralRe: Code worked in visual studio 6, not working in visual c++ 2005 Pin
Steve Echols6-Jun-07 11:42
Steve Echols6-Jun-07 11:42 
Questionhow i can compare 2 string without caring for Uppercase? Pin
Immunity185-Jun-07 13:49
Immunity185-Jun-07 13:49 
AnswerRe: how i can compare 2 string without caring for Uppercase? Pin
Christian Graus5-Jun-07 14:09
protectorChristian Graus5-Jun-07 14:09 
GeneralRe: how i can compare 2 string without caring for Uppercase? Pin
Immunity185-Jun-07 14:10
Immunity185-Jun-07 14:10 
GeneralRe: how i can compare 2 string without caring for Uppercase? Pin
Immunity185-Jun-07 14:11
Immunity185-Jun-07 14:11 
GeneralRe: how i can compare 2 string without caring for Uppercase? Pin
Naveen5-Jun-07 14:19
Naveen5-Jun-07 14:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.