Привет
ну вот купил себе книжку Седжвика и начал методично по ней учится но вот проблем небольшой.
у меня сентос 4.1
вот такая прога
#include <iostream.h>
#include <stdlib.h>
using namespace std;
struct node {
int item;
node* next;
node( int x, node* t) {
item = x;
next = t;
}
};
typedef node *link;
int main(int argc,
char *argv[]) {
int i = 0;
int N = atoi(argv[1]);
int M = atoi(argv[2]);
link t = new node(1,0);
t->next = t;
link x = t;
for (i = 2; i <= N; i++) {
x = (x->next = new node(i,t));
}
cout << "x->item " << x->item << endl;
while (x != x->next) {
for (i = 1; i < M; i++) {
x = x->next;
}
x->next = x->next->next;
}
cout << x->item << endl;
}
выполняю g++ josef_orig.cpp
выдает следующее
In file included from /usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/backward/iost ream.h:31,
from josef_orig.cpp:1:
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/backward/back ward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
josef_orig.cpp:16: error: `typedef struct node*link' redeclared as different kind of symbol
/usr/include/unistd.h:729: error: previous declaration of `int link(const char*, const char*)'
josef_orig.cpp:16: error: declaration of `typedef struct node*link'
/usr/include/unistd.h:729: error: conflicts with previous declaration `int link(const char*, const char*)'
josef_orig.cpp:16: error: declaration of `typedef struct node*link'
/usr/include/unistd.h:729: error: conflicts with previous declaration `int link(const char*, const char*)'
josef_orig.cpp: In function `int main(int, char**)':
josef_orig.cpp:24: error: expected `;' before "t"
josef_orig.cpp:24: warning: statement is a reference, not call, to function `link'
josef_orig.cpp:25: error: `t' undeclared (first use this function)
josef_orig.cpp:25: error: (Each undeclared identifier is reported only once for each function it appears in.)
josef_orig.cpp:27: error: expected `;' before "x"
josef_orig.cpp:27: warning: statement is a reference, not call, to function `link'
josef_orig.cpp:30: error: `x' undeclared (first use this function)
в чем проблема не пойму обьясните
![](/photos/18345.jpg)
Ответ на:
комментарий
от ale
![](/photos/19924.jpg)
Ответ на:
комментарий
от aton
![](/img/p.gif)
![](/img/p.gif)
![](/img/p.gif)
Ответ на:
комментарий
от AnToXa
![](/photos/10758.jpg)
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.
Похожие темы
- Форум string.h подключен, а тип string не распознаеться. (2005)
- Форум Warnings при использовании basename () (2004)
- Форум Проблемы с gcc в Mandrake 10.1 (2005)
- Форум Linux+Vortex2=Unreal??? (2003)
- Форум G++ 4.7.0~, x86_64-pc-solaris2.11: conflicts with new declaration with 'C++' linkage (2011)
- Форум Заголовочный файл (2006)
- Форум Проблема с установкой PyPanel (Debian 5.0) (2009)
- Форум Ждем 2.6.35.2? (2010)
- Форум sizeof(winsize) или sizeof(struct winsize) (2015)
- Форум что не так в использовании структуры (2008)