LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-27-2007, 01:54 AM   #1
RHLinuxGUY
Member
 
Registered: Oct 2003
Distribution: Ubuntu 7.04
Posts: 889
Blog Entries: 1

Rep: Reputation: 30
C++: Loop error: name lookup of `var' changed for new ISO `for' scoping... etc.


I'm getting an error(shown further below) when I try to copy values from a std::string vector to another std::string vector:

Using a similar command as the following:
Code:
g++ -g file.cpp -W -Wall -ansi -pedantic `sdl-config --cflags --libs` -lSDL -o file
The error:

Code:
p_keyboard.h:127: error: name lookup of `a_iter' changed for new ISO `for' scoping
p_keyboard.h:124: error:   using obsolete binding at `a_iter'
Here is the code in which it is happening in.

Code:
for (unsigned int a_iter = 0; a_iter < keys_.size(); ++a_iter); // Line 124
{
    keys[ keys.size() -1 ].resize(keys[ keys.size() -1 ].size() +1);
    keys[ keys.size() -1 ][ a_iter ] = keys_[ a_iter ]; // Line 127
}
`keys_' is a parameter to the function this block of code exists in.

It looks like this:
Code:
int function(/*...*/ std::vector<std::string> keys_  /*...*/);
`keys' is a variable in a public part of a class.

It looks like this:
Code:
std::vector<std::vector<std::string> > keys;
As you can see I am trying to copy over the information from each element of `keys_', to every new element of `keys[ keys.size() -1 ][ a_iter ]'.

What am I doing wrong?

Any lack of information on my part, please notify me(not that anyone wouldn't ), so I can fill in the void.

Thanks in advance!

Last edited by RHLinuxGUY; 02-27-2007 at 01:58 AM.
 
Old 02-27-2007, 08:26 AM   #2
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
You've got a semicolon at the end of the for line. I also know you're using VS2005, and VS2003 would not have caught this error.
 
Old 02-27-2007, 11:35 AM   #3
RHLinuxGUY
Member
 
Registered: Oct 2003
Distribution: Ubuntu 7.04
Posts: 889

Original Poster
Blog Entries: 1

Rep: Reputation: 30
Thanks!

Quote:
I also know you're using VS2005, and VS2003 would not have caught this error.
You mean if ? I'm sure you mean that.
 
Old 02-27-2007, 01:28 PM   #4
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Yeah, suppose so. That error just seemed word-for-word what VS2005 produced, but I must have been imagining things
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't mount iso 'could not find any loop device' dethree Slackware 1 06-23-2005 01:14 AM
can't mount cdrom (after mounting .iso once, using -o loop) cmbguy Linux - Newbie 4 03-20-2005 11:25 PM
Cannot mount more than 8 iso image files as loop device marsim Debian 4 11-09-2004 04:05 AM
changed default runlevel from 3 to 4 in inittab- now I'm stuck in a loop Earl Parker II Linux - Newbie 15 07-12-2004 08:37 AM
loop for generating var names ? Dominik Programming 1 12-11-2003 04:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration