Раньше компилялась, а теперь не.... (((

SvinkaVJeansah

Раньше компилялась, а теперь нет...
Была freebsd4.10, а стала 5.3. Смена компиляторов плохо повлияла?
У кого-нить есть последние стандарты C++?
 oppa$ make
c++ -Wall -o jc cell.c main.c inout.c jc.c titem.c matrix.c
In file included from cell.c:1:
main.h:19: error: ISO C++ forbids declaration of `vector' with no type
main.h:19: error: expected `;' before '<' token
main.h:20: error: ISO C++ forbids declaration of `vector' with no type
main.h:20: error: expected `;' before '<' token
main.h:44: error: ISO C++ forbids declaration of `vector' with no type
main.h:44: error: expected `;' before '<' token
main.h:45: error: ISO C++ forbids declaration of `vector' with no type
main.h:45: error: expected `;' before '<' token
main.h: In member function `int titem::item(int)':
main.h:53: error: 'class titem' has no member named 'items'
main.h: At global scope:
main.h:66: error: `string' does not name a type
main.h:67: error: `string' does not name a type
main.h:69: error: ISO C++ forbids declaration of `vector' with no type
main.h:69: error: expected `;' before '<' token
main.h:70: error: ISO C++ forbids declaration of `vector' with no type
main.h:70: error: expected `;' before '<' token
main.h:76: error: field `string' has incomplete type
cell.c: In constructor `cell::cell':
cell.c:5: error: 'class cell' has no member named 'x'
cell.c:6: error: 'class cell' has no member named 'y'
cell.c: In member function `void cell::init(int, int)':
cell.c:18: error: 'class cell' has no member named 'x'
cell.c:19: error: 'class cell' has no member named 'y'
cell.c: In member function `void cell::out':
cell.c:24: error: `vector' undeclared (first use this function)
cell.c:24: error: (Each undeclared identifier is reported only once for each function it appears in.)
cell.c:24: error: expected primary-expression before "bool"
cell.c:24: error: expected `;' before "bool"
cell.c:24: error: `p' undeclared (first use this function)
cell.c:24: error: `x' undeclared (first use this function)
cell.c:26: error: `cout' undeclared (first use this function)
cell.c:31: error: expected primary-expression before "bool"
cell.c:31: error: expected `;' before "bool"
cell.c:31: error: `y' undeclared (first use this function)
cell.c:35: error: `endl' undeclared (first use this function)
cell.c: In member function `void cell::markit(char)':
cell.c:54: error: 'class cell' has no member named 'x'
cell.c:55: error: 'class cell' has no member named 'y'
cell.c:56: error: `cout' undeclared (first use this function)
cell.c:56: error: `endl' undeclared (first use this function)
cell.c:61: error: 'class cell' has no member named 'x'
cell.c:62: error: 'class cell' has no member named 'y'
cell.c: In member function `void cell::setifdone(char)':
cell.c:72: error: `vector' undeclared (first use this function)
cell.c:72: error: expected primary-expression before "bool"
cell.c:72: error: expected `;' before "bool"
cell.c:75: error: `tmp' undeclared (first use this function)
cell.c:75: error: 'class cell' has no member named 'x'
cell.c:76: error: 'class cell' has no member named 'y'
cell.c:77: error: `cout' undeclared (first use this function)
cell.c:77: error: `endl' undeclared (first use this function)
cell.c:82: error: expected primary-expression before "bool"
cell.c:82: error: expected `;' before "bool"
cell.c:82: error: `p' undeclared (first use this function)
cell.c:97:3: warning: no newline at end of file
In file included from main.c:1:
main.h:19: error: ISO C++ forbids declaration of `vector' with no type
main.h:19: error: expected `;' before '<' token
main.h:20: error: ISO C++ forbids declaration of `vector' with no type
main.h:20: error: expected `;' before '<' token
main.h:44: error: ISO C++ forbids declaration of `vector' with no type
main.h:44: error: expected `;' before '<' token
main.h:45: error: ISO C++ forbids declaration of `vector' with no type
main.h:45: error: expected `;' before '<' token
main.h: In member function `int titem::item(int)':
main.h:53: error: 'class titem' has no member named 'items'
main.h: At global scope:
main.h:66: error: `string' does not name a type
main.h:67: error: `string' does not name a type
main.h:69: error: ISO C++ forbids declaration of `vector' with no type
main.h:69: error: expected `;' before '<' token
main.h:70: error: ISO C++ forbids declaration of `vector' with no type
main.h:70: error: expected `;' before '<' token
main.h:76: error: field `string' has incomplete type
main.c: In function `int main(int, char**)':
main.c:9: error: `string' undeclared (first use this function)
main.c:9: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.c:9: error: expected `;' before "tmp_filename"
main.c:10: error: `cin' undeclared (first use this function)
main.c:10: error: `tmp_filename' undeclared (first use this function)
main.c: In function `void cred':
main.c:27: error: `cout' undeclared (first use this function)
main.c:27: error: `endl' undeclared (first use this function)
main.c:28:2: warning: no newline at end of file
In file included from inout.c:1:
main.h:19: error: ISO C++ forbids declaration of `vector' with no type
main.h:19: error: expected `;' before '<' token
main.h:20: error: ISO C++ forbids declaration of `vector' with no type
main.h:20: error: expected `;' before '<' token
main.h:44: error: ISO C++ forbids declaration of `vector' with no type
main.h:44: error: expected `;' before '<' token
main.h:45: error: ISO C++ forbids declaration of `vector' with no type
main.h:45: error: expected `;' before '<' token
main.h: In member function `int titem::item(int)':
main.h:53: error: 'class titem' has no member named 'items'
main.h: At global scope:
main.h:66: error: `string' does not name a type
main.h:67: error: `string' does not name a type
main.h:69: error: ISO C++ forbids declaration of `vector' with no type
main.h:69: error: expected `;' before '<' token
main.h:70: error: ISO C++ forbids declaration of `vector' with no type
main.h:70: error: expected `;' before '<' token
main.h:76: error: field `string' has incomplete type
inout.c: In member function `int jc::load_txt':
inout.c:7: error: `ifstream' undeclared (first use this function)
inout.c:7: error: (Each undeclared identifier is reported only once for each function it appears in.)
inout.c:7: error: expected `;' before "f"
inout.c:9: error: `f' undeclared (first use this function)
inout.c:11: error: `cout' undeclared (first use this function)
inout.c:11: error: `endl' undeclared (first use this function)
inout.c:16: error: 'class jc' has no member named 'name'
inout.c:17: error: 'class jc' has no member named 'fname_in'
inout.c:17: error: 'class jc' has no member named 'name'
inout.c:26: error: 'class jc' has no member named 'tx'
inout.c:41: error: 'class jc' has no member named 'tx'
inout.c:42: error: 'class jc' has no member named 'ty'
inout.c:53: error: 'class jc' has no member named 'tx'
inout.c:58: error: 'class jc' ha

Chupa

лучше б кусок кода такой же длины выложил

SvinkaVJeansah

oppa$ cat main.h
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <iomanip>
#include <ctype.h>
#include <stdlib.h>
#define MAX_PATH 1024
#define MAX_LINE 1024
#include "matrix.c" // our matrix template
class cell
{
private:
vector<bool> x;
vector<bool> y;
bool done;
bool black;
int test;
public:
void init(int, int); // grows to required sizes
void out;
void set(int);
bool testit;
void markit(char); // char 'x' or 'y'
void setifdone(char); // char 'x' or 'y'
cell;
~cell;
friend class titem;
friend class jc;
};
class titem // title item class
{
private:
vector<int> items;
vector<int> beg;
int size;
public:
//vector<int> beg;
titem;
~titem{};
void add(int);
int getsize { return this->size; };
int item(int pos) { return this->items[pos]; };
bool move_block(int);
bool test;
void clear{ };
void set{ };
friend class jc;
};
class jc // our main task - JC class
{
private:
string name; // JC name
string fname_in; // JC input file name
int x, y; // JC size
vector<titem> tx; // x-axis title info
vector<titem> ty; // y-axis title info
matrix<cell> *m; // X*Y "battlefield"
int done_count; // counter to follow the developments %
int last_pass;
public:
jc(string); // (1)
~jc;
int init; // (3) inits a "battlefield"
int load_txt; // (2) loads a JC in title structures
int write_html; // output
int process; // resolving problem %)
void process_line(int);
void process_col(int);
bool finish; // true when done_count = x*y
bool progress; // true when two consequent passes differs each other
};
oppa$

oppa$ cat cell.c
#include "main.h"
cell::cell
{
this->x.push_back(0); // inserts a 0(empty)-bit in our boolean vectors
this->y.push_back(0);
this->done = 0;
}
cell::~cell
{
}
void cell::init(int ix, int iy)
{
for(int i=1; i<=ix; i++) this->x.push_back(0);
for(int i=1; i<=iy; i++) this->y.push_back(0);
}
void cell::out
{
for(vector<bool>:: const_iterator p = x.begin; p!=x.end; ++p)
{
cout << *p;
}
cout << "*";
for(vector<bool>:: const_iterator p = y.begin; p!=y.end; ++p)
{
cout << *p;
}
cout << "[" << this->test << "]]]]" << endl;;
}
bool cell::testit
{
if(this->done)
{
ifthis->test == 0) && (!this->black return true;
ifthis->test > 0) && (this->black return true;
return false;
}
else return true;
}
void cell::markit(char ch) // char 'x' or 'y'
{
if(this->test == 0)
{
switch(ch) {
case 'x': this->x[0] = true; break;
case 'y': this->y[0] = true; break;
default: cout << "Bad in cell::markit" << endl;
}
}else
{
switch(ch) {
case 'x': this->x[this->test + 1] = true; break;
case 'y': this->y[this->test + 1] = true; break;
default: cout << "Bad in cell::markit" << endl;
}
}
}
void cell::setifdone(char ch)
{
vector <bool> tmp;
switch(ch) {
case 'x': tmp = &(this->x); break;
case 'y': tmp = &(this->y); break;
default: cout << "Bad in cell::markit" << endl;
}
int lmark_count = 0; // resolved only in case, when only one marked position
for(vector <bool> :: const_iterator p = tmp.begin; p != tmp.end; ++p)
{
if(tmp[p] == true) lmark_count++;
}
if(lmark_count == 1)
{
this->done = true;
if(tmp[0] == 1) this->black = true;
else this->black = false;
}
else if(lmark_count > 1 && tmp[0] == 0)
{
this->done = true;
this->black = true;
}
}oppa$

Chupa

using namespace std;

SvinkaVJeansah

thx.
Оставить комментарий
Имя или ник:
Комментарий: