473,321 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Errors in "stl_algobase.h"

9
I fixed all of the errors in the code that I wrote, however, I am now getting errors in this document called "stl_algobase.h" which I don't even know what it is.

they follow the form of

instantiated from `_OutputIterator std::_copy_aux2(_InputIterator,_InputIterator,_Out putIterator,_false_type)[with_InputIteator=char[*][10],_OutputIterator=int]'

I think it is trying to tell me that I am trying to output an array of characters like integers, but I don't know how to fix it.

Here is the code that I think is causing the problem:

Expand|Select|Wrap|Line Numbers
  1. void print(char temporaryArray[][10], int MAX_SIZE)
  2. {
  3.    for(int local = 0; local < MAX_SIZE; local++)
  4.    {
  5.      for( int loop = 0; loop <=9; loop++)
  6.      {
  7.         cout<< temporaryArray[local][loop];
  8.      }
  9.         cout<<endl;
  10.    }
  11. }
  12.  
May 12 '10 #1
9 5772
Banfa
9,065 Expert Mod 8TB
Normally there are several other errors round an error like this all relating to the same problem. When posting errors you should post them all and you should post them in there entirety because trying to diagnose problems with half the information is very hard.

The error you have printed is not the actually error but just a pointer to the code that cause the code with the error in it to be instantiated.
May 12 '10 #2
v859
9
This is the entire error screen:

C:\Dev-Cpp\include\c++\3.4.2\bits\stl_algobase.h In function `_OutputIterator std::__copy(_RandomAccessIterator, _RandomAccessIterator, _OutputIterator, std::random_access_iterator_tag) [with _RandomAccessIterator = char (*)[10], _OutputIterator = int]':

266 C:\Dev-Cpp\include\c++\3.4.2\bits\stl_algobase.h instantiated from `_OutputIterator std::__copy_aux2(_InputIterator, _InputIterator, _OutputIterator, __false_type) [with _InputIterator = char (*)[10], _OutputIterator = int]'

308 C:\Dev-Cpp\include\c++\3.4.2\bits\stl_algobase.h instantiated from `_OutputIterator std::__copy_ni2(_InputIterator, _InputIterator, _OutputIterator, __false_type) [with _InputIterator = char (*)[10], _OutputIterator = int]'

327 C:\Dev-Cpp\include\c++\3.4.2\bits\stl_algobase.h instantiated from `_OutputIterator std::__copy_ni1(_InputIterator, _InputIterator, _OutputIterator, __false_type) [with _InputIterator = char (*)[10], _OutputIterator = int]'

358 C:\Dev-Cpp\include\c++\3.4.2\bits\stl_algobase.h instantiated from `_OutputIterator std::copy(_InputIterator, _InputIterator, _OutputIterator) [with _InputIterator = char (*)[10], _OutputIterator = int]'

190 C:\Documents and Settings\myfirst.lastname\My Documents\Untitled1.cpp instantiated from here

247 C:\Dev-Cpp\include\c++\3.4.2\bits\stl_algobase.h invalid type argument of `unary *'

This is the line of code the error is coming from
Expand|Select|Wrap|Line Numbers
  1. copy(tempArray, inputArray, MAX_SIZE);
  2.  
And this is the function
Expand|Select|Wrap|Line Numbers
  1. void copy(char temporaryArray1[][10], char previousarray[][10], int MAX_SIZE)
  2. {
  3.    for(int i = 0; i < MAX_SIZE; i++)
  4.    {
  5.        for(int j =0; j <= 9; j++)
  6.        {
  7.           temporaryArray1[i][j] = previousarray[i][j];
  8.        }
  9.     }
  10. }
  11.  
May 12 '10 #3
v859
9
I actually solved that problem.

I had as my prototype:
Expand|Select|Wrap|Line Numbers
  1. void copy(char[][10], int);
  2.  
but two character arrays as inputs.

However I am now getting the following errors

221 C:\Documents and Settings\vincent.cannavale\My Documents\Untitled1.cpp new declaration `char copy(char (*)[10], char (*)[10], int)'

11 C:\Documents and Settings\vincent.cannavale\My Documents\Untitled1.cpp ambiguates old declaration `void copy(char (*)[10], char (*)[10], int)'
May 12 '10 #4
Banfa
9,065 Expert Mod 8TB
So does line 190 of Untitled1.cpp fall within the function you have posted?

I have to say your posted code compiles fine for me.

Also stl_algobase.h is part fo the STL Algorithms implementation in gcc and this error speaks of a problem in either a STL algorithm or an STL container none of which appear in the posted code snippet.
May 12 '10 #5
v859
9
Thanks for everyone's help.

I fixed all of the compile time errors, however, the program now crashes in runtime, and I have no idea why.
May 12 '10 #6
Banfa
9,065 Expert Mod 8TB
Run it in the debugger you might get extra information.

Or if the program is short just step through it in the debugger until it crashes.

Or narrow down where it crashes slowly with repetitive runs of the debugger, rather than step use next to execute a whole function, work out which function call in main causes the crash, the run the debugger again and step into that function and then use next again to work out which line causes the crash and continue until you narrow it down to a few lines.

Examine code (either right away for after narrowing down the search area) for possible causes of the crash like writing outside the bounds of an array.
May 12 '10 #7
v859
9
How do you use the debugger, every time I try, it doesn't work right.
May 12 '10 #8
Banfa
9,065 Expert Mod 8TB
You will have to describe your problem a little better than "it doesn't work right".

What do you do?
What happens/what do you see?
What is your platform?
Are you using an IDE?
May 12 '10 #9
weaknessforcats
9,208 Expert Mod 8TB
The problem is that the STL has an algorithm named copy. Because you have coded using namespace std, that template is being used instead of your function.

The easy fix is to rename your funciton to MyCopy and all these errors will go away.

BTW: There is also a swap in STL so don't name your function swap.

The better fix is to put your function in your own namesopace:

Expand|Select|Wrap|Line Numbers
  1. namespace MyStuff
  2. {
  3.      void copy(char temporaryArray1[][10], char previousarray[][10], int MAX_SIZE) 
  4.    for(int i = 0; i < MAX_SIZE; i++) 
  5.    { 
  6.        for(int j =0; j <= 9; j++) 
  7.        { 
  8.           temporaryArray1[i][j] = previousarray[i][j]; 
  9.        } 
  10.     } 
  11.  
  12. }
  13.  
  14.  
  15. } // end of namespace
This should be in its own implementation file.

Then create a header file:

Expand|Select|Wrap|Line Numbers
  1. namespace MyStuff
  2. {
  3.      void copy(char temporaryArray1[][10], char previousarray[][10], int MAX_SIZE); 
  4.  
  5. } // end of namespace
#include this header in the file with main() and make your call:

Expand|Select|Wrap|Line Numbers
  1. MyStuff::copy(tempArray, inputArray, MAX_SIZE); 
May 13 '10 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: mikey_boy | last post by:
Hello! Curious if anyone could give me a hand. I wrote this PHP script with makes a simple connection to a mysql database called firstdb and just pulls back the results and displays on the...
2
by: Trev | last post by:
SQL Server 2000 BE, Access 2002 FE. I want to write a stored procedure, that will among other things log errors to a table, I want to be able to report a summary of work done and errors to the...
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
0
by: doli | last post by:
Hi, I have the following piece of code which iterates through the potential errors: i =0 For Each error_item in myConn.Errors DTSPackageLog.WriteStringToLog myConn.Errors(i).Description...
4
by: johnb41 | last post by:
I have a form with a bunch of textboxes. Each text box gets validated with the ErrorProvider. I want the form to process something ONLY when all the textboxes are valid. I found a solution,...
2
by: Samuel R. Neff | last post by:
Within the past few weeks we've been getting a lot of compiler errors in two classes when no errors actually exist. The error always reports as Name '_stepResizeRelocator' is not declared. ...
24
by: pat | last post by:
Hi everyone, I've got an exam in c++ in two days and one of the past questions is as follows. Identify 6 syntax and 2 possible runtime errors in this code: class demo {
8
by: ImOk | last post by:
I just have a question about trapping and retrying errors especially file locking or database locks or duplicate key errors. Is there a way after you trap an error to retry the same line that...
0
by: clemrock | last post by:
Help w/ errors.add_to_base between controller and model Hello, I'm having trouble in routing some errors between model and controller. The errors produced in the controller...
2
by: =?Utf-8?B?UmFuZHlz?= | last post by:
This just started when I updated to sp 1 working on a APS.net, Visual Studio 2008, c# Project. When I open a project, I get tons of Errors showing in the list 300+ if I double click on them I go...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.