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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:23:45+00:00 2026-06-06T04:23:45+00:00

I am trying to run an old C++ code in Linux (Redhat). I am

  • 0

I am trying to run an old C++ code in Linux (Redhat). I am using gcc version 4.1.2.
here is the code sample where i am getting error :

           template <class TP> TP *GCVVector<TP>::Find(const TP &Obj)
        {
        #ifdef WIN32
                using namespace std;
                typedef typename vector<TP>::iterator Viterator;
        #else
        #ifdef __HP_aCC 
                using namespace std;
                typedef typename vector<TP>::iterator Viterator;
        #else
                using namespace std;
                typedef typename std::vector<TP>::iterator Viterator;
        #endif
        #endif

                Viterator pCurrent =NULL ;

The error i am getting is this :

         /trnuser1/rmtrain/DevelopmentEnv/Generic/CoreObjects/GCVVector.h: In member          function âTP* GCVVector<TP>::Find(const TP&) [with TP = GCVAsso<GCVString, GCVString>::KeyNode]â:
        /trnuser1/rmtrain/DevelopmentEnv/Generic/CoreObjects/GCVAsso.h:165:   instantiated from âbool GCVAsso<KTP, VTP>::Add(KTP, VTP) [with KTP = GCVString, VTP = GCVString]â
        /trnuser1/rmtrain/DevelopmentEnv/Generic/CoreObjects/GCVTransformationServices.h:69:   instantiated from here
         /trnuser1/rmtrain/DevelopmentEnv/Generic/CoreObjects/GCVVector.h:398: error: conversion from âlong intâ to non-scalar type â__gnu_cxx::__normal_iterator<GCVAsso<GCVString, GCVString>::KeyNode*, std::vector<GCVAsso<GCVString, GCVString>::KeyNode, std::allocator<GCVAsso<GCVString, GCVString>::KeyNode> > >â requested
           /trnuser1/rmtrain/DevelopmentEnv/Generic/CoreObjects/GCVAsso.h:165:   instantiated from âbool GCVAsso<KTP, VTP>::Add(KTP, VTP) [with KTP = GCVString, VTP = GCVString]â
        /trnuser1/rmtrain/DevelopmentEnv/Generic/CoreObjects/GCVTransformationServices.h:69:   instantiated from here
        /trnuser1/rmtrain/DevelopmentEnv/Generic/CoreObjects/GCVVector.h:403: error: no match for âoperator=â in âpCurrent = GCVVector<TP>::BinarySearch [with TP = GCVAsso<GCVString, GCVString>::KeyNode](0l, (GCVVector<TP>::GetSize [with TP = GCVAsso<GCVString, GCVString>::KeyNode]() - 1l), ((const GCVAsso<GCVString, GCVString>::KeyNode&)((const GCVAsso<GCVString, GCVString>::KeyNode*)Obj)))â
        /usr/lib/gcc/x86_64-redhat-   linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator.h:634: note: candidates are: __gnu_cxx::__normal_iterator<GCVAsso<GCVString, GCVString>::KeyNode*, std::vector<GCVAsso<GCVString, GCVString>::KeyNode, std::allocator<GCVAsso<GCVString, GCVString>::KeyNode> > >& __gnu_cxx::__normal_iterator<GCVAsso<GCVString,         GCVString>::KeyNode*, std::vector<GCVAsso<GCVString, GCVString>::KeyNode, std::allocator<GCVAsso<GCVString, GCVString>::KeyNode> > >::operator=(const __gnu_cxx::__normal_iterator<GCVAsso<GCVString, GCVString>::KeyNode*, std::vector<GCVAsso<GCVString, GCVString>::KeyNode, std::allocator<GCVAsso<GCVString, GCVString>::KeyNode> > >&)
        make[2]: ***    [CMakeFiles/GCVCore.dir/trnuser1/rmtrain/DevelopmentEnv/Generic/CoreObjects/GCVTransformationServices.o] Error 1
        make[1]: *** [CMakeFiles/GCVCore.dir/all] Error 2
  • 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-06T04:23:47+00:00Added an answer on June 6, 2026 at 4:23 am

    The original code was written against an STL where std::vector<T>::iterator was a raw pointer and so could be (and needed to be) initialised to NULL.

    For full compatibility, change the line to

    Viterator pCurrent = Viterator();
    

    In C++11, you can use

    Viterator pCurrent{};
    

    By full compatibility it is meant here that Viterator may be simply a bare pointer. In such a case, explicitly setting it to a default-constructed value will set it to NULL. Below is a simple example to demonstrate it.

    #include <iostream>
    
    typedef void * Iterator;
    
    int main(int, char**)
    {
      Iterator v1, v2=Iterator();
      std::cout << "uninitialized pointer: " << v1 << "\ninitialized pointer: " << v2 << std::endl;
    }
    

    The output is:

    uninitialized pointer: 0x7fff5fc01052
    initialized pointer: 0
    

    Note that the program may still be incorrect if it does anything with pCurrent, other than assigning it a new value (it would be valid to compare it against itself, or another iterator initialised by copying it, but comparing against a non-singular iterator, or a separately default value-constructed iterator would be undefined).

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

Sidebar

Related Questions

I am trying to run an old C++ code in Linux (Redhat). I am
So I keep getting this error when trying to compile C++ code using CodeBlocks.
I am trying to run someone else's (4 year old) code from sourceforge. I
I'm getting a (to me) weird run-time access violation error. I have a class,
I'm trying to adapt some old build scripts to run with an RPM installation
When trying to run an Eclipse Dynamic Web Project under a Tomcat setup using
I am trying to migrate some code from an old naming scheme to the
Here is my code segment I am trying to dismiss dialog but it is
I´m trying to run an old .NET application from an ASP.NET website. After reading
I am having this odd error with my code. I am trying to troubleshoot

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.