Jump to content
  • Advertisement
Sign in to follow this  
v0dKA

Errors in included files (iostream, iosfwd, winbase.h, winuser.h, etc) [fixed]

This topic is 4426 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm getting a slew of cryptic errors in some standard #include files. Here are some examples:
c:\program files\microsoft visual studio 8\vc\include\iostream(16) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio 8\vc\include\iostream(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(17) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio 8\vc\include\iostream(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(18) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio 8\vc\include\iostream(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(18) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(19) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio 8\vc\include\iostream(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(19) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(35) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio 8\vc\include\iostream(35) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(35) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(36) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio 8\vc\include\iostream(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(36) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(37) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio 8\vc\include\iostream(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(37) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(38) : error C2143: syntax error : missing ';' before '*'
c:\program files\microsoft visual studio 8\vc\include\iostream(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(38) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(52) : error C2146: syntax error : missing ';' before identifier 'cin'
c:\program files\microsoft visual studio 8\vc\include\iostream(52) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(52) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(53) : error C2146: syntax error : missing ';' before identifier 'cout'
c:\program files\microsoft visual studio 8\vc\include\iostream(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(54) : error C2146: syntax error : missing ';' before identifier 'cerr'
c:\program files\microsoft visual studio 8\vc\include\iostream(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(55) : error C2146: syntax error : missing ';' before identifier 'clog'
c:\program files\microsoft visual studio 8\vc\include\iostream(55) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(55) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(57) : error C2146: syntax error : missing ';' before identifier 'wcin'
c:\program files\microsoft visual studio 8\vc\include\iostream(57) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(57) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(58) : error C2146: syntax error : missing ';' before identifier 'wcout'
c:\program files\microsoft visual studio 8\vc\include\iostream(58) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(58) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(59) : error C2146: syntax error : missing ';' before identifier 'wcerr'
c:\program files\microsoft visual studio 8\vc\include\iostream(59) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(59) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(60) : error C2146: syntax error : missing ';' before identifier 'wclog'
c:\program files\microsoft visual studio 8\vc\include\iostream(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\program files\microsoft visual studio 8\vc\include\iostream(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

c:\program files\microsoft visual studio 8\vc\include\iosfwd(606) : error C2988: unrecognizable template declaration/definition
c:\program files\microsoft visual studio 8\vc\include\iosfwd(606) : error C2059: syntax error : 'constant'
c:\program files\microsoft visual studio 8\vc\include\iosfwd(614) : error C2653: '_Traits' : is not a class or namespace name
c:\program files\microsoft visual studio 8\vc\include\iosfwd(614) : error C2653: '_Traits' : is not a class or namespace name
c:\program files\microsoft visual studio 8\vc\include\iosfwd(615) : error C2653: '_Traits' : is not a class or namespace name
c:\program files\microsoft visual studio 8\vc\include\iosfwd(616) : error C2143: syntax error : missing ';' before '{'
c:\program files\microsoft visual studio 8\vc\include\iosfwd(616) : error C2447: '{' : missing function header (old-style formal list?)
c:\program files\microsoft visual studio 8\vc\include\iosfwd(624) : error C2988: unrecognizable template declaration/definition
c:\program files\microsoft visual studio 8\vc\include\iosfwd(624) : error C2059: syntax error : 'constant'
c:\program files\microsoft visual studio 8\vc\include\iosfwd(630) : error C2143: syntax error : missing ';' before '}'



Every time I include iostream, for example, the error count goes up by nearly 100. I'm also getting some odd errors of my own, such as these when I try to write std::ifstream fp; (Should be noted that fstream is included, albeit via an additional header): C2039: 'ifstream' : is not a member of 'std', C2065: 'ifstream' : undeclared identifier, C2059: syntax error : ',', C2146: syntax error : missing ';' before identifier 'fp'. I had something similar before, where my Visual Studio compiler treated my C++ code as if it was C. I fixed it by renaming the file extensions from .c to .cpp. However, my file extensions are all right this time, and every file and the whole project is set to compile as C++ (under properties). This project used to be a C project, but I rewrote it to use C++. I suppose that VS may still be treating the project as a C project. If so, I need help fixing it! Here's an outline of all the files in my project, and their #includes:
// each header file has an include guard that makes sure it's included only once

config.h
========
#include "Log.h"
#include <string>
#include <fstream>

connection.h
============
#include "constants.h"
#include "Log.h"
#include <iostream>
#include <SDL_net.h>

constants.h
===========
#include "client_serv.h"
#include <string>

EL.h
====
#include "Connection.h"
#include "constants.h"
#include "Log.h"

Log.h
=====
#include "constants.h"
#include <fstream>

// The files config.cpp, connection.cpp, EL.cpp, and log.cpp each includes their respective header files, one .h file per one .cpp file

main.cpp
========
#include "Config.h"
#include "Connection.h"
#include "constants.h"
#include "EL.h"
#include "Log.h"
#include <iostream>		// ******** ~100 errors
#include <strsafe.h>
#include <string>
#include <SDL_net.h>



I'm quite frustrated after having spent days converting this project from C to C++ and not getting it compiled. Please help me! [Edited by - v0dKA on July 7, 2006 5:07:46 PM]

Share this post


Link to post
Share on other sites
Advertisement
Most of the errors seem to stem from:
c:\program files\microsoft visual studio 8\vc\include\iostream(59) : error C2146: syntax error : missing ';' before ...

My guess:
You forgot to put a semicolon after one of your classes, ie:

class CClass
{
}; <--make sure thats there

Share this post


Link to post
Share on other sites
Most of us like to put standard headers before local ones. The weird single-pass compile process in C++ makes this a pretty smart thing to do, actually.

Share this post


Link to post
Share on other sites
Quote:
Original post by Driv3MeFar
Most of the errors seem to stem from:
c:\program files\microsoft visual studio 8\vc\include\iostream(59) : error C2146: syntax error : missing ';' before ...

My guess:
You forgot to put a semicolon after one of your classes, ie:

class CClass
{
}; <--make sure thats there


I double checked all my classes, and that's unfortunately not the problem.

Share this post


Link to post
Share on other sites
Quote:
Original post by Oluseyi
Most of us like to put standard headers before local ones. The weird single-pass compile process in C++ makes this a pretty smart thing to do, actually.


Wow. That fixed it! I'm still getting a slew of errors, but at least they're truly my own this time [smile].

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!