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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:38:00+00:00 2026-06-01T12:38:00+00:00

OSX 10.7, XCode 4. I have a small problem: I need to push back

  • 0

OSX 10.7, XCode 4.

I have a small problem: I need to push back a 2D vector<vector<float>> in to a 3D Vector, after a process of selection. It throws the EXC_BAD_ACCESS error in the push_back function in the stl::vector template. It seems like it should be simple (I’ve worked with complex data structures many times before), I’ve tried a varying amount of ideas but to no avail. Everything else works and outputs the values that I’d expect to the command line. I’m sure its code blindness, and some easy rep to pick up.

I ask only because I believe that my syntax is correct, but at compile time I have issues. Heres some sample code:

Implementation:

for(int i=0;i<fdisVec.size();i++){

    int j;

        if(fdisVec[i] < fdisVec2[i]){

            j = 0;

        }

        else if(fdisVec2[i] < fdisVec[i]){

            j = 1;

        }

    clusters[j].push_back(allMfccs[i]);

}

and my .h has the objects declared as such (public members of class):

    vector< vector <float> > allMfccs;
    vector< vector < vector <float> > > clusters; 

In case it helps, fdisVec and fdisVec2 are also 2d Vectors, however, the “if else” statement responds how I want it to – I highly doubt it would be something to do with that.

  • 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-01T12:38:01+00:00Added an answer on June 1, 2026 at 12:38 pm

    What if fdisVec[i] == fdisVec2[i] ?

    In this case, j is left uninitialized (garbage), and sometimes the value is not a valid index for your clusters vector.

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

Sidebar

Related Questions

Suppose I have have made a an osX app without using Xcode. After compiling
I have all the prereq's installed.. I am on osx lion 10.7.2 xcode: $
I have created a small application in Xcode. How can i make that application
I'm a developer making the transition from Linux/Emacs to OSX/Xcode. Does anyone have any
I run MAC OSX 10.6.7 and have Xcode 3.2.6 and I do NOT have
I have installed GCC-10.7-v2.pkg found at https://github.com/kennethreitz/osx-gcc-installer/downloads And I have removed Xcode completely following
I am writing a program using MAC OSX 10.6.6 and xcode 3.2 I have
I'm running some code on Mac OSX 10.6.6 and XCode 3.2.4 and I have
I have some cpp code which I transfered from Linux to OSX. The problem
I have Mac OSX 10.5.8 with Xcode installed. I want to avoid MacPorts and

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.