# Thread: Help me with these errors... :-(

1. ## Help me with these errors... :-(

okay, I have a complicated problem here, that's probably alot simpler than I think, but here goes... I'm getting these errors on Bloodshed Dev C++ V4.9.8.0. I put the errors then the line it highlites in the file...

This is a pretty extensive list of errors, and i'd like to preface them by saying the only reason i'm posting them is because i've never seen any of them before, and can't figure out what to do from the string of files it sends me through... the only thing I can think of is chaniging the header files myself, seeing as it complains that they don't follow standards and are missing semi-colons, etc... if anybody can make any sense out of this mess, that would be greatly appreciated... and I'm attatching the source I used to get these errors... (which is still kinda messy because I started messing around with pointers when I got these errors, but the compiler stops before past including iostream)

Code:
----------
45 C:\Program Files\Dev-Cpp\include\c++\iosfwd
In file included from C:/Program Files/Dev-Cpp/include/c++/iosfwd

#include <bits/stringfwd.h> // For string forward declarations.
----------
44 C:\Program Files\Dev-Cpp\include\c++\ios
from C:/Program Files/Dev-Cpp/include/c++/ios
#include <iosfwd>
----------
45 C:\Program Files\Dev-Cpp\include\c++\ostream
from C:/Program Files/Dev-Cpp/include/c++/ostream
#include <ios>
----------
45 C:\Program Files\Dev-Cpp\include\c++\iostream
from C:/Program Files/Dev-Cpp/include/c++/iostream
#include <ostream>
----------
18 C:\TCWIN45\BIN\dev c++\blackjack\main.cpp
from main.cpp
#include <iostream>
----------
46 C:\Program Files\Dev-Cpp\include\c++\bits\stringfwd.h
semicolon missing

namespace std //from stringfwd.h
----------
46 C:\Program Files\Dev-Cpp\include\c++\bits\stringfwd.h
parse error before `

namespace std //from stringfwd.h
----------
47 C:\Program Files\Dev-Cpp\include\c++\bits\stringfwd.h
ISO C++ forbids

{	//from stringfwd.h, right under that last error
---------
47 C:\Program Files\Dev-Cpp\include\c++\bits\stringfwd.h
syntax error before `
{	//same as last one
---------
51 C:\Program Files\Dev-Cpp\include\c++\bits\stringfwd.h
`char_traits' is not

template<> struct char_traits<char>;
----------
59 C:\Program Files\Dev-Cpp\include\c++\bits\stringfwd.h
parse error before `<

template<typename _CharT, typename _Traits = char_traits<_CharT>,
----------
63 C:\Program Files\Dev-Cpp\include\c++\bits\stringfwd.h
syntax error before `

typedef basic_string<char>    string;
----------
64 C:\Program Files\Dev-Cpp\include\c++\bits\stringfwd.h
syntax error before `

typedef basic_string<wchar_t> wstring;
----------
6 C:\Program Files\Dev-Cpp\include\stddef.h
In file included from C:/Program Files/Dev-Cpp/include/stddef.h

#include_next<stddef.h>
----------
6 C:\Program Files\Dev-Cpp\include\stddef.h
from C:/Program Files/Dev-Cpp/include/stddef.h

#include_next<stddef.h>
----------
48 C:\Program Files\Dev-Cpp\include\c++\cstddef
from C:/Program Files/Dev-Cpp/include/c++/cstddef

#include <stddef.h>
----------
50 C:\Program Files\Dev-Cpp\include\c++\cstdio
from C:/Program Files/Dev-Cpp/include/c++/cstdio

#include <cstddef>
----------
35 C:\Program Files\Dev-Cpp\include\c++\mingw32\bits\c++io.h
from C:/Program Files/Dev-Cpp/include/c++/mingw32/bits/c++io.h

#include <cstdio>
----------
44 C:\Program Files\Dev-Cpp\include\c++\bits\fpos.h
from C:/Program Files/Dev-Cpp/include/c++/bits/fpos.h

#include <bits/c++io.h>
----------
46 C:\Program Files\Dev-Cpp\include\c++\iosfwd
from C:/Program Files/Dev-Cpp/include/c++/iosfwd

#include <bits/fpos.h>
----------
44 C:\Program Files\Dev-Cpp\include\c++\ios
from C:/Program Files/Dev-Cpp/include/c++/ios

#include <iosfwd>
----------
45 C:\Program Files\Dev-Cpp\include\c++\ostream
from C:/Program Files/Dev-Cpp/include/c++/ostream

#include <ios>
----------
45 C:\Program Files\Dev-Cpp\include\c++\iostream
from C:/Program Files/Dev-Cpp/include/c++/iostream

#include <ostream>
----------
18 C:\TCWIN45\BIN\dev c++\blackjack\main.cpp
from main.cpp

#include <iostream>
----------
149 C:\Program Files\Dev-Cpp\lib\gcc-lib\mingw32\3.2\include\stddef.h
template

typedef __PTRDIFF_TYPE__ ptrdiff_t;
----------
149 C:\Program Files\Dev-Cpp\lib\gcc-lib\mingw32\3.2\include\stddef.h
confused by earlier errors, bailing out

2. ## Need more from you.

I can't compile your source file with out your header. I'd get errors about everything that belongs.

3. here it is:
Code:
/********MAIN.CPP*********/
/*
main.cpp => defines entrypoint for user

This program started as an assignment in a programming class, but after a
long time persuing other side-projects, I came back to it because I needed
a break from the other projects (battle system and AI)

Major_Small
*/

#ifndef _GAME_H
#define _GAME_H
#include "game.h"
#endif

#ifndef _iostream_h
#define _iostream_h
#include <iostream>
#endif

using std::cin;
using std::cout;

int main()
{
char *name=new char[20];	//holds player's name

cout<<"Enter your Name: ";
cin.getline(name,20,'\n');

gameClass blackjack(name);
blackjack.play();

delete[]name;
return 0;
}

4. This is how an class should look like :
Code:
class gameClass
{
// code
};
In your print function you have this code:
Code:
for(int i=0;i<p1.hitcount;i++)
cout<<card(p,i)<<' ';
but I cant seem to find where p is declared

There seems to be alot of other error aswell, like
Code:
if(p1.card[i]==1)
return 'A';
p1 is a cards struct variable put it doesnt contain a variable card[], maybe you want to use hand[] instead.

5. I agree, you have way too many errors in your program. Most seem to be due to your not good at writing with C++. You can't seem to remember when a variable is declaired or not. Hell you don't even know your own class too well.

6. ^ .......... you, stupid @\$\$hole

>>This is how an class should look like...
oops... forgot about that...

>>p1 is a cards struct variable put it doesnt contain a variable card[], maybe you want to use hand[] instead.
I've done that so many times... in an older program I had it the other way and now I'm confusing myself...

>>but I cant seem to find where p is declared
p and d are meant to be literal values... I forgot about the quotes

Thanks for that... it cleared up the errors, but I still don't know where they came from... any help with that?

7. Most errors that complain about a header file are generally caused by the programmer making a syntax mistake or two. When code is error free by syntax you would not get those type of errors. Of course you could have a corupted file (rare event) that could cause strange errors like those. An improper setting coud cause that too. A bad lib file as well.

Popular pages Recent additions