Author Topic: Problem With 2d Vector in Latest Release CB 10.05  (Read 5279 times)

Offline nyislander

  • Multiple posting newcomer
  • *
  • Posts: 10
Problem With 2d Vector in Latest Release CB 10.05
« on: December 27, 2010, 10:42:51 pm »
I installed the latest version of CB with mingw and when I try to debug the attached code I get the following error message which points at the declaration of the 2d temp vector: "no matching function for call to 'std::vector<std::vector<int ..." .  If I use a 1d vector it works.  Any suggestions?

Code
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;


int main()
{ // main

int j = 0, h = 0;
vector< vector< int > > temp ( 5, 0 );

        for (h = 0; h < 5; ++h){for (j = 0; j < 5; ++j){temp[h].push_back(j); cout << setw(2) << temp[h][j];}}
        system("PAUSE");

} // end main

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Problem With 2d Vector in Latest Release CB 10.05
« Reply #1 on: December 27, 2010, 11:05:24 pm »
1. Try the debuggers branch nightly (probably won't help)
2. Paste the debugger's debug log. This log is shown by Settings -> Compiler and debugger -> Debugger -> Display debugger's log.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline nyislander

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Problem With 2d Vector in Latest Release CB 10.05
« Reply #2 on: December 27, 2010, 11:44:11 pm »
#1: didn't try.
#2:
Code
-------------- Build: Debug in junk ---------------

Compiling: main.cpp
In file included from c:\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/vector:65,
                 from C:\Cpp\junk\main.cpp:4:
c:\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_vector.h: In member function 'void std::vector<_Tp, _Alloc>::_M_initialize_dispatch(_Integer, _Integer, std::__true_type) [with _Integer = int, _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]':
c:\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_vector.h:303:   instantiated from 'std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const _Alloc&) [with _InputIterator = int, _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]'
C:\Cpp\junk\main.cpp:17:   instantiated from here
c:\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_vector.h:991: error: no matching function for call to 'std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >::_M_fill_initialize(size_t, int&)'
c:\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_vector.h:1033: note: candidates are: void std::vector<_Tp, _Alloc>::_M_fill_initialize(size_t, const _Tp&) [with _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
 

Offline danselmi

  • Developer
  • Almost regular
  • *****
  • Posts: 206
Re: Problem With 2d Vector in Latest Release CB 10.05
« Reply #3 on: December 27, 2010, 11:52:46 pm »
This is not a CB related problem. Check the initialization of temp. Try this one:
Code
vector< vector< int > > temp(5);

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Problem With 2d Vector in Latest Release CB 10.05
« Reply #4 on: December 27, 2010, 11:57:01 pm »
This is not a CB related problem. Check the initialization of temp. Try this one:
Code
vector< vector< int > > temp(5);

As danselmi wrote:
not related to C::B in any way and therfore violating our forum rules.
C::B is not a compiler "just" an IDE, that works with many compilers.

Topic locked !!