Thread: Problem running a Cboard C++ tutorial!

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    5

    Problem running a Cboard C++ tutorial!

    hello folks,

    i've been trying to run the vector example off this site. I've cut and paste it into a Dev-C++ cpp file, then used Borland to compile it, but it's just spat it back out... is there anything else I need to do?

    check out the tutorial for vectors from here... that's the one. Anything else I need to run it?

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    what were the errors? Maybe Dev-C++ doesn't have some of the libraries.

  3. #3
    Unregistered
    Guest
    There do appear to be problems there. First, there is no...

    using namespace std;

    ... after the includes, put that in, that'll get rid of most of the compile errors. Second the line...

    example.switch(1, 2); //Switches elements 1 and 2

    ... comment that out. Switch is not implemented on all compilers, in fact, I cannot find it in my copy of the standard! I'm looking into this, sorry for the inconvenience.

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Sorry, that was me. For some reason the board logged me out.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    5
    mkay... trying it now. cheers.

  6. #6
    Registered User
    Join Date
    Nov 2001
    Posts
    5
    Warning W8037 vectorexample.cpp 7: Non-const function vector<int,allocator<int>>::push_back(const int &) called for const object in function operator <<(ostream &,const vector<int,allocator<int> > &)

    Error E2193 vectorexample.cpp 7: Too few parameters in call to 'vector<int,allocator<int> >::push_back(const int &)' in function operator <<(ostream &,const vector<int,allocator<int> > &)

    Error E2108 vectorexample.cpp 7: Improper use of typedef 'ostream_iterator<int,char,char_traits<char> >' in function operator <<(ostream &,const vector<int,allocator<int> > &)

    Error E2285 vectorexample.cpp 7: Could not find a match for 'copy<InputIterator,OutputIterator>(void,const int *,undefined)' in function operator <<(ostream &,const vector<int,allocator<int> > &)

    Warning W8057 vectorexample.cpp 9: Parameter 'v' is never used in function operator <<(ostream &,const vector<int,allocator<int> > &)

    Warning W8049 vectorexample.cpp 13: Use '> >' for nested templates instead of '>>' in function main()

    Error E2451 vectorexample.cpp 13: Undefined symbol 'example' in function main()

    Error E2299 vectorexample.cpp 13: Cannot generate template specialization from 'allocator<T>' in function main()

    Error E2108 vectorexample.cpp 14: Improper use of typedef 'vector<int,undefined>' in function main()

    *** 6 errors in Compile ***

  7. #7
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Bleaaarggh! Hmmm,

    >>> Dev-C++ cpp file, then used Borland to compile

    ... I don't use either, I just put it through MS VC++ 6 and it compiles and runs fine. (It doesn't swap of course but otherwise works as described).

    The errors look like they are objecting to something in the overloaded stream insertion operator which is part of the class, and hence, not under your control.

    More info... exactly what compiler is this? The Borland 5.5 command line freebie?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Keep running program and 'int' problem
    By willrs2 in forum C++ Programming
    Replies: 21
    Last Post: 02-10-2008, 11:22 AM
  2. Problem running in non-debug mode
    By swgh in forum Tech Board
    Replies: 1
    Last Post: 12-17-2007, 04:56 AM
  3. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  4. Problem running program
    By JOCAAN in forum C++ Programming
    Replies: 3
    Last Post: 10-19-2007, 04:09 PM
  5. For CBoard Newbies
    By ILoveVectors in forum C++ Programming
    Replies: 12
    Last Post: 07-29-2005, 09:57 AM