Mam problem z programowaniem w C++. Za każdym razem gdy próbuję dodać bibliotekę Iostream wyskakuje mi 31 błędów zawsze tyle samo. Czy ktoś miał podobny problem i czy można to w jakiś sposób naprawić?
Jaki kompilator, jaki błąd ??
komplilator dev C++, tych błędów jest rzekomo 31 i kiedy wybieram opcję pokazania rezultatu, ukazuje się to:
In file included from C:\DEV-C_~1\Include\G__~1\iostream.h:31,
from c:\documents and settings\administrator\pulpit\początki c++\plik.cpp:3:
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `int main()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:35: parse error before string constant
In file included from C:\DEV-C_~1\Include\G__~1\streambuf.h:36,
from C:\DEV-C_~1\Include\G__~1\iostream.h:31,
from c:\documents and settings\administrator\pulpit\początki c++\plik.cpp:3:
C:\DEV-C_~1\Include\G__~1\libio.h:269: non-local variable `struct main()::_IO_FILE_plus _IO_stdin_' uses local type `main()::_IO_FILE_plus'
C:\DEV-C_~1\Include\G__~1\libio.h:269: non-local variable `struct main()::_IO_FILE_plus _IO_stdout_' uses local type `main()::_IO_FILE_plus'
C:\DEV-C_~1\Include\G__~1\libio.h:269: non-local variable `struct main()::_IO_FILE_plus _IO_stderr_' uses local type `main()::_IO_FILE_plus'
C:\DEV-C_~1\Include\G__~1\libio.h:295: parse error before string constant
C:\DEV-C_~1\Include\G __~1\libio.h:299: non-local function `int__ uflow(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G __~1\libio.h:300: non-local function `int__ overflow(main()::_IO_FILE *, int)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:318: non-local function `int _IO_getc(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:319: non-local function `int _IO_putc(int, main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:320: non-local function `int _IO_feof(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:321: non-local function `int _IO_ferror(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:323: non-local function `int _IO_peekc_locked(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:329: non-local function `void _IO_flockfile(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:330: non-local function `void _IO_funlockfile(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:331: non-local function `int _IO_ftrylockfile(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:345: non-local function `int _IO_vfscanf(main()::_IO_FILE *, const char *, char *, int *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:346: non-local function `int _IO_vfprintf(main()::_IO_FILE *, const char *, char *)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:347: non-local function `_G_ssize_t _IO_padn(main()::_IO_FILE *, int, int)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:348: non-local function `_G_size_t _IO_sgetn(main()::_IO_FILE *, void *, unsigned int)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:354: non-local function `_G_fpos_t _IO_seekoff(main()::_IO_FILE *, long int, int, int)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:355: non-local function `_G_fpos_t _IO_seekpos(main()::_IO_FILE *, long long int, int)' uses local type `main()::_IO_FILE'
C:\DEV-C_~1\Include\G__~1\libio.h:358: non-local function `void _IO_free_backup_area(main()::_IO_FILE *)' uses local type `main()::_IO_FILE'
In file included from C:\DEV-C_~1\Include\G__~1\iostream.h:31,
from c:\documents and settings\administrator\pulpit\początki c++\plik.cpp:3:
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:37: parse error before `}'
C:\DEV-C_~1\Include\G__~1\streambuf.h:77: syntax error before `;'
C:\DEV-C_~1\Include\G__~1\streambuf.h:78: syntax error before `;'
C:\DEV-C_~1\Include\G__~1\streambuf.h:80: syntax error before `;'
C:\DEV-C_~1\Include\G__~1\streambuf.h:133: ANSI C++ forbids declaration `_G_ssize_t' with no type
C:\DEV-C_~1\Include\G__~1\streambuf.h:133: parse error before `;'
C:\DEV-C_~1\Include\G__~1\streambuf.h:276: parse error before `{'
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `void set_offset(int)':
C:\DEV-C_~1\Include\G__~1\streambuf.h:278: `_pos' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h:278: (Each undeclared identifier is reported only once
C:\DEV-C_~1\Include\G__~1\streambuf.h:278: for each function it appears in.)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:279: parse error before `public'
C:\DEV-C_~1\Include\G__~1\streambuf.h:281: destructors must be member functions
C:\DEV-C_~1\Include\G__~1\streambuf.h:283: parse error before `)'
C:\DEV-C_~1\Include\G__~1\streambuf.h:287: parse error before `{'
C:\DEV-C_~1\Include\G__~1\streambuf.h:289: `friend' can only be specified inside a class
C:\DEV-C_~1\Include\G__~1\streambuf.h:290: `friend' can only be specified inside a class
C:\DEV-C_~1\Include\G__~1\streambuf.h:291: `friend' can only be specified inside a class
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `const void *& _vtable()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:292: `_IO_FILE' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h:292: parse error before `)'
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:293: parse error before `protected'
C:\DEV-C_~1\Include\G__~1\streambuf.h:295: syntax error before `*'
C:\DEV-C_~1\Include\G__~1\streambuf.h:299: non-member function `gptr()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * gptr()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:299: `_flags' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h:299: `_IO_save_base' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h:299: `_IO_read_ptr' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:300: non-member function `pptr()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * pptr()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:300: `_IO_write_ptr' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:302: non-member function `egptr()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * egptr()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:302: `_IO_save_end' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h:302: `_IO_read_end' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:303: non-member function `epptr()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * epptr()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:303: `_IO_write_end' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:304: non-member function `pbase()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * pbase()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:304: `_IO_write_base' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:306: non-member function `eback()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * eback()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:306: `_IO_read_base' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:307: non-member function `base()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * base()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:307: `_IO_buf_base' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:308: non-member function `ebuf()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * ebuf()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:308: `_IO_buf_end' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:309: non-member function `blen()' cannot have `const' method qualifier
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `void setg(char *, char *, char *)':
C:\DEV-C_~1\Include\G__~1\streambuf.h:323: invalid use of `this' in non-member function
C:\DEV-C_~1\Include\G__~1\streambuf.h:323: implicit declaration of function `int _IO_free_backup_area(...)'
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * shortbuf()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:325: `_shortbuf' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `char * Bptr()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:334: `_IO_backup_base' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `int have_markers()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:340: `_markers' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:346: parse error before `int'
C:\DEV-C_~1\Include\G__~1\streambuf.h:350: destructors must be member functions
C:\DEV-C_~1\Include\G__~1\streambuf.h:350: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:351: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:352: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:353: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:354: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:356: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:357: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:358: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:359: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:361: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:363: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:365: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:366: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:367: syntax error before `*'
C:\DEV-C_~1\Include\G__~1\streambuf.h:368: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:369: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:371: `mark' was not declared in this scope
C:\DEV-C_~1\Include\G__~1\streambuf.h:371: parse error before `='
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `void allocbuf()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:384: implicit declaration of function `int doallocbuf(...)'
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:388: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:389: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:390: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:394: type specifier omitted for parameter
C:\DEV-C_~1\Include\G__~1\streambuf.h:394: parse error before `,'
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `int sputc(int)':
C:\DEV-C_~1\Include\G__~1\streambuf.h:395: invalid use of `this' in non-member function
C:\DEV-C_~1\Include\G__~1\streambuf.h:395: implicit declaration of function `int _IO_putc(...)'
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `int sbumpc()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:396: invalid use of `this' in non-member function
C:\DEV-C_~1\Include\G__~1\streambuf.h:396: implicit declaration of function `int _IO_getc(...)'
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `int sgetc()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:397: invalid use of `this' in non-member function
C:\DEV-C_~1\Include\G__~1\streambuf.h:397: invalid use of `this' in non-member function
C:\DEV-C_~1\Include\G__~1\streambuf.h:397: invalid use of `this' in non-member function
C:\DEV-C_~1\Include\G __~1\streambuf.h:397: implicit declaration of function `int__ underflow(...)'
C:\DEV-C_~1\Include\G__~1\streambuf.h:397: invalid use of `this' in non-member function
C:\DEV-C_~1\Include\G__~1\streambuf.h: In function `int snextc()':
C:\DEV-C_~1\Include\G__~1\streambuf.h:399: invalid use of `this' in non-member function
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:403: type specifier omitted for parameter
C:\DEV-C_~1\Include\G__~1\streambuf.h:403: parse error before `,'
C:\DEV-C_~1\Include\G__~1\streambuf.h:405: type specifier omitted for parameter
C:\DEV-C_~1\Include\G__~1\streambuf.h:405: parse error before `)'
C:\DEV-C_~1\Include\G__~1\streambuf.h:411: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:412: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:413: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:414: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:415: virtual outside class declaration
C:\DEV-C_~1\Include\G__~1\streambuf.h:420: parse error before `}'
C:\DEV-C_~1\Include\G__~1\streambuf.h:425: base class `streambuf' has incomplete type
C:\DEV-C_~1\Include\G__~1\streambuf.h:446: ANSI C++ forbids declaration `streampos' with no type
C:\DEV-C_~1\Include\G__~1\streambuf.h:446: `streampos' declared as a `virtual' field
C:\DEV-C_~1\Include\G__~1\streambuf.h:446: parse error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:447: ANSI C++ forbids declaration `streambuf' with no type
C:\DEV-C_~1\Include\G__~1\streambuf.h:447: `streambuf' declared as a `virtual' field
C:\DEV-C_~1\Include\G__~1\streambuf.h:447: parse error before `*'
C:\DEV-C_~1\Include\G__~1\streambuf.h:448: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:449: syntax error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:458: ANSI C++ forbids declaration `streamsize' with no type
C:\DEV-C_~1\Include\G__~1\streambuf.h:458: `streamsize' declared as a `virtual' field
C:\DEV-C_~1\Include\G__~1\streambuf.h:458: parse error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:459: ANSI C++ forbids declaration `streampos' with no type
C:\DEV-C_~1\Include\G__~1\streambuf.h:459: `streampos' declared as a `virtual' field
C:\DEV-C_~1\Include\G__~1\streambuf.h:459: declaration of `int filebuf::streampos'
C:\DEV-C_~1\Include\G__~1\streambuf.h:446: conflicts with previous declaration `int filebuf::streampos'
C:\DEV-C_~1\Include\G__~1\streambuf.h:459: parse error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:460: ANSI C++ forbids declaration `streamsize' with no type
C:\DEV-C_~1\Include\G__~1\streambuf.h:460: `streamsize' declared as a `virtual' field
C:\DEV-C_~1\Include\G__~1\streambuf.h:460: declaration of `int filebuf::streamsize'
C:\DEV-C_~1\Include\G__~1\streambuf.h:458: conflicts with previous declaration `int filebuf::streamsize'
C:\DEV-C_~1\Include\G__~1\streambuf.h:460: parse error before `('
C:\DEV-C_~1\Include\G__~1\streambuf.h:459: duplicate member `filebuf::streampos'
C:\DEV-C_~1\Include\G__~1\streambuf.h:460: duplicate member `filebuf::streamsize'
C:\DEV-C_~1\Include\G__~1\streambuf.h: In method `int filebuf::is_open() const':
C:\DEV-C_~1\Include\G__~1\streambuf.h:442: `_fileno' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:469: `sb' was not declared in this scope
C:\DEV-C_~1\Include\G__~1\streambuf.h:469: parse error before `*'
C:\DEV-C_~1\Include\G__~1\streambuf.h:469: prototype for `void ios::init(...)' does not match any in class `ios'
C:\DEV-C_~1\Include\G__~1\streambuf.h:259: candidate is: void ios::init(streambuf *, ostream * = 0)
C:\DEV-C_~1\Include\G__~1\streambuf.h: In method `void ios::init(...)':
C:\DEV-C_~1\Include\G__~1\streambuf.h:470: `sb' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h:471: `tie_to' undeclared (first use this function)
C:\DEV-C_~1\Include\G__~1\streambuf.h: At top level:
C:\DEV-C_~1\Include\G__~1\streambuf.h:479: parse error before `*'
C:\DEV-C_~1\Include\G__~1\streambuf.h:489: parse error before `}'
In file included from c:\documents and settings\administrator\pulpit\początki c++\plik.cpp:3:
C:\DEV-C_~1\Include\G__~1\iostream.h:50: parse error before `*'
C:\DEV-C_~1\Include\G__~1\iostream.h:64: type specifier omitted for parameter
C:\DEV-C_~1\Include\G__~1\iostream.h:64: parse error before `)'
C:\DEV-C_~1\Include\G__~1\iostream.h:65: type specifier omitted for parameter
C:\DEV-C_~1\Include\G__~1\iostream.h:65: parse error before `)'
C:\DEV-C_~1\Include\G__~1\iostream.h:66: `ios::ostream::write(...)' has already been declared in `ios::ostream'
C:\DEV-C_~1\Include\G__~1\iostream.h:67: type specifier omitted for parameter
C:\DEV-C_~1\Include\G__~1\iostream.h:67: parse error before `)'
C:\DEV-C_~1\Include\G__~1\iostream.h:68: `ios::ostream::write(...)' has already been declared in `ios::ostream'
C:\DEV-C_~1\Include\G__~1\iostream.h:69: type specifier omitted for parameter
C:\DEV-C_~1\Include\G__~1\iostream.h:69: parse error before `)'
C:\DEV-C_~1\Include\G__~1\iostream.h:70: `ios::ostream::write(...)' has already been declared in `ios::ostream'
C:\DEV-C_~1\Include\G__~1\iostream.h:71: `streampos' was not declared in this scope
C:\DEV-C_~1\Include\G__~1\iostream.h:71: confused by earlier errors, bailing out
To zapodaj jeszcze kod ;]
żeby sprawdzić o co chodzi wpisałem najprostrzy z możliwych:
main()
{
#include
}
i ciągle te same błędy ;(
Hmmmm, jak zrobisz tak to powinno być ok
#include
main()
{
}
A poza tym to polecam tworzyć projekt, czyli Plik -> Nowy -> Projekt ;]