unable to pass vector by reference

Discussion in 'Software' started by vkaul1, Jun 26, 2009.

  1. vkaul1

    vkaul1

    Joined:
    Jun 26, 2009
    Messages:
    1
    I am not able to pass vector by reference if I read it from a txt file and populate it. What is wrong with the code here

    #include <iostream>
    #include <fstream>
    #include <vector>
    #include <math.h>


    void signedDistanceTransform2D(vector<int> &iContour);
    using namespace std;

    int main()
    {
    fstream infile("crack_index.txt");
    vector<int> iContour(100);
    if(!infile)
    { cout<<"Error opening output file"<<endl;
    system("pause");
    return -1;
    }
    else
    { int C_point=0;
    // checking for the current point
    while(infile>> C_point)
    {
    //putting the initial crack points in the vector
    iContour.push_back(C_point);



    }


    signedDistanceTransform2D(iContour);

    return 0;
    }
    }


    void signedDistanceTransform2D(vector<int> &iContour) {}



    It is throwing errors like which is bizarre

    \Users\vivek\Documents\main.cpp(7) : error C2065: 'vector' : undeclared identifier
    C:\Users\vivek\Documents\main.cpp(7) : error C2062: type 'int' unexpected
    C:\Users\vivek\Documents\main.cpp(13) : error C2872: 'vector' : ambiguous symbol
    C:\Users\vivek\Documents\main.cpp(13) : error C2872: 'vector' : ambiguous symbol
    C:\Users\vivek\Documents\main.cpp(13) : error C2062: type 'int' unexpected
    C:\Users\vivek\Documents\main.cpp(25) : error C2065: 'iContour' : undeclared identifier
    C:\Users\vivek\Documents\main.cpp(25) : error C2228: left of '.push_back' must have class/struct/union type
    C:\Users\vivek\Documents\main.cpp(32) : error C2065: 'signedDistanceTransform2D' : undeclared identifier
    C:\Users\vivek\Documents\main.cpp(43) : error C2872: 'vector' : ambiguous symbol
    C:\Users\vivek\Documents\main.cpp(43) : error C2872: 'vector' : ambiguous symbol
    C:\Users\vivek\Documents\main.cpp(43) : error C2062: type 'int' unexpected
    C:\Users\vivek\Documents\main.cpp(43) : error C2143: syntax error : missing ';' before '{'
    C:\Users\vivek\Documents\main.cpp(43) : error C2447: missing function header (old-style formal list?)
    Error executing cl.exe.

    main.obj - 13 error(s), 0 warning(s)
     
    vkaul1, Jun 26, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Welshwizard

    True vector???

    Welshwizard, Dec 23, 2003, in forum: Computer Support
    Replies:
    2
    Views:
    1,938
    MrToad
    Dec 23, 2003
  2. Bobby Tupper

    true vector

    Bobby Tupper, Dec 23, 2003, in forum: Computer Support
    Replies:
    4
    Views:
    2,458
    Brian
    Dec 23, 2003
  3. Guest

    ZA Pro - True Vector Problem

    Guest, May 24, 2004, in forum: Computer Support
    Replies:
    1
    Views:
    1,684
    @}-}-------Rosee
    May 24, 2004
  4. John
    Replies:
    1
    Views:
    1,179
    Parko
    Aug 12, 2004
  5. Brian

    Qimage: Vector vs Lanczos, Max vs High??

    Brian, Nov 21, 2003, in forum: Digital Photography
    Replies:
    2
    Views:
    615
    Bart van der Wolf
    Nov 22, 2003
Loading...

Share This Page