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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:26:18+00:00 2026-05-23T11:26:18+00:00

The error is: In function ‘int returnShortestWeightedBranch(std::vector<route, std::allocator<route> >*)’: error: name lookup of ‘jj’

  • 0

The error is:

In function ‘int returnShortestWeightedBranch(std::vector<route, std::allocator<route> >*)’:
error: name lookup of ‘jj’ changed for ISO ‘for’ scoping
note: (if you use ‘-fpermissive’ G++ will accept your code)

The code is:

for (int i = 0; i< routeVector.size(); i++)
        {
            if (routeVector[i].exitPoint == exitPointDetailsVector[preserveL].exitPoint)
            {
                cout << "\n-----------parent: " << routeVector[i].exitPoint;
                branch obj;
                obj.connectedExitPoint = exitPointDetailsVector[preserveI].exitPoint;
                routeVector[i].selectedBranchesVector.push_back (obj);

                for (int jj = 0; jj < routeVector[i].selectedBranchesVector.size(); jj++);
                {
                    cout << "\n-----------branch: " << routeVector[i].selectedBranchesVector[jj].connectedExitPoint;
                }
            }
        }

What can be the problem here?

EDIT 1:

I changed the following:

for (int jj = 0; jj < routeVector[i].selectedBranchesVector.size(); jj++);

to:

int jj;
for (jj = 0; jj < routeVector[i].selectedBranchesVector.size(); jj++);

and now it is working!! I fail to understand the REASONS.

  • 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-23T11:26:18+00:00Added an answer on May 23, 2026 at 11:26 am

    You have a semicolon at the end of the inner for statement. That ends the scope of jj there, so it is not visible inside the block.

    Edit
    You have solved the scope problem, but still have your for loop executing just

    <nothing>;
    

    Remove the semicolon after the parenthesis!

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

Sidebar

Related Questions

I have an error during compiling: raja@raja-desktop:~/socket$ g++ Socket.cpp Socket.cpp: In member function ‘int
jQuery's getScript function doesn't seem to support an error callback function. I can't use
When compiling this code I get the following error : In function 'int main()':
Possible Duplicate: Error handling in C code Let's say you have a function: int
The documentation indicates that the error: option function will make available: XHR instance, a
i am getting the compile error: Error 7 error C2084: function 'Boolean IsPointInRect(...)' already
im getting a CFDictionaryAddValue(): immutable collection 0xd5aea0 given to mutating function error when i
Is there a way to give a form a special error rendering function in
I'm trying to do this (which produces an unexpected T_VARIABLE error): public function createShipment($startZip,
With GCC 4.1.2, I get the error tmp.cpp:8: error: invalid function declaration for the

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.