GIDForums  

Go Back   GIDForums > Computer Programming Forums > CPP / C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 04-Feb-2008, 14:12
cpp-cpp cpp-cpp is offline
New Member
 
Join Date: Feb 2008
Posts: 2
cpp-cpp is on a distinguished road

Compilation Error


Can any body say why this code does not compile?

CPP / C++ / C Code:
‫>‪#include<vector‬‬
‫>‪template<class T‬‬
‫‪class MyVec‬‬
‫{‬
‫:‪public‬‬
‬
     ‫;‪bool operator==(const MyVec<T>& m) const‬‬
‫:‪private‬‬
   ‫‪std::vector<T> _m;‬‬
‫;}
‬‫>‪template<class T‬‬
‫‪bool MyVec<T>::operator==(const MyVec<T> &m) const‬‬
‫{‬
   ‫;)(‪std::vector<T>::const_iterator it1 = _m.begin‬‬
   ‫;)(‪std::vector<T>::const_iterator it2 = m._m.begin‬‬
   ‫))(‪while (it1 != _m.end() && it2 != m._m.end‬‬
   ‫{‬
        ‫)‪if (*it1 != *it2‬‬
           ‫;‪return false‬‬
       ‫;‪++it1‬‬
       ‫;‪++it2‬‬
   ‫}‬
    ‫;))(‪return (it1 == _m.end() && it2 == m._m.end‬‬
‫}‬
  #2  
Old 04-Feb-2008, 15:17
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 926
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Compilation Error


As a start, some of the ending <, many of the {, and a few ( are improperly positioned. [turned the wrong way]

For example:
1. #include <something>, NOT: #include <something<

2. if ( aCondition ), NOT: if (aCondition (

3. function [and loop] blocks start with {, and end with } -- NOT the other way around.

There may be more problems, but fix these first.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 04-Feb-2008, 16:56
cpp-cpp cpp-cpp is offline
New Member
 
Join Date: Feb 2008
Posts: 2
cpp-cpp is on a distinguished road

Re: Compilation Error


Hi ,
yes, this is the copy and paste fault ...!
I do know how to write code in cpp !
I thought that this is going to be trivial !

Thank you any way !
 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using C command line compilation aijazbaig1 CPP / C++ Forum 4 05-Feb-2007 17:59
Alt. Problem: PHP 4.4 GD compilation errors Fezzen Computer Software Forum - Linux 2 12-Aug-2005 21:16
Unfamiliar with this compilation error code <compilation of class into object file> jkube1980 CPP / C++ Forum 1 24-Apr-2005 14:57
What is "Ambigious symbol" ??*( a compilation error) small_ticket CPP / C++ Forum 2 07-Jan-2005 21:10
Compiler that Shows Stages of Compilation? BobbyMurcerFan C Programming Language 2 26-Nov-2004 18:03

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:23.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.