Error including queue.h

When I include queue.h I get the following compiler errors in list.h

c:\program files\microsoft visual studio\vc98\include\list.h(37) : error C2146: syntax error : missing ';' before identifier 'Length'
c:\program files\microsoft visual studio\vc98\include\list.h(37) : error C2501: 'DWORD' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\list.h(37) : error C2501: 'Length' : missing storage-class or type specifiers
c:\program files\microsoft visual studio\vc98\include\list.h(53) : error C2146: syntax error : missing ';' before identifier 'GetPrevLink'
c:\program files\microsoft visual studio\vc98\include\list.h(53) : error C2433: 'WINAPI' : 'inline' not permitted on data declarations
c:\program files\microsoft visual studio\vc98\include\list.h(53) : fatal error C1004: unexpected end of file found

This is an MFC app using the sharred dll.

The code that includes queue.h is provided below.

Any help is appreciated!

#ifndef _AUTOMOBILESIMULATOR_H
#define _AUTOMOBILESIMULATOR_H

#include <queue.h>

class AutoSimMainWin;
class AutoSimDlg;
class NetworkSimulator;
class Monitor;
class Engine;
class AutomobileSimulator
{
 // Member variables
 private:
  AutoSimMainWin*   mainWin;
  AutoSimDlg*       autoSimDlg;
  NetworkSimulator* netSim;
  Monitor*          mon;
  Engine*           eng;

  Queue             temperatureQueue;
  Queue             pressureQueue;
  Queue             rpmQueue;

  int replenishTempValue;
  int replenishPressValue;
  int replenishRPMValue;

 // Member functions
 public:
  AutomobileSimulator( AutoSimMainWin* aMainWin, AutoSimDlg* aAutoSimDlg );
  ~AutomobileSimulator( );

  void StartEngine( );
  void StopEngine( );
  int  GetNextTempEvent( );
  int  GetNextPressEvent( );
  int  GetNextRPMEvent( );
  void UpdateTemp( int aTemp );
  void UpdatePress( int aPress );
  void UpdateRPM( int aRPM );
  void ShowMessageText( char* aText );

 private:
  void LoadTempEventQ( );
  void LoadPressEventQ( );
  void LoadRPMEventQ( );
  void ReplenishTempEventQ( );
  void ReplenishPressEventQ( );
  void ReplenishRPMEventQ( );
};

#endif



Answer this question

Error including queue.h

  • Kliot

    Since this is a problem related to an old version of the compiler can it be solved by porting the code to MS Visual Studio .NET 2003 Enterprise Edition

    I need to work on a C# project in .NET, can I compile the code I've written with VC 6.0 using C++ .NET 2003

    Any issues I should be aware of when porting the code

    It's getting furstrating working with VC 6.0.  I worked arround the STL queue problem by using simple int arrays, got the program to compile and when I run it I'm getting a memory access violation - "the memory could not be "read" error when calling a function with a pointer to an object.  In the debugger the address contained in the pointer variable seems to be valid!!!

    Do you think moving to C++ .NET 2003 will resolve this run-time error as well, or is this error code related

    Thanks for all your assistance.

    You've been quite helpful.

  • Vorrtexx

    As Jonathan suggested, internal compiler errors are compiler bugs but the support for VC6.0 is over and you won't be able to get the issue fixed.

    Modifying your code or the header closer to where the error was reported might solve the problem.

    Thanks,
      Ayman Shoukry
      VC++ team

  • Ming D

    Because <list.h> is not part of STL. If you want to use std::list then you need to include <list> not <list.h>

  • wwwalrus

    In your case replace

    #include <queue.h>

    with

    #include <queue>

    using namespace std;



  • veryhotsausage

    What I'm confused about is why do I need to include Windows heades just to include an STL class header

    Is the list.h that the complier is complaining about part of the STL or some Windows list.h

    If its a Windows class why is it getting compiled when I include queue.h, which is an STL class and should have nothing to do with Windows

    Thanks.

  • scrptman

    Unfortunately this is the Visual C++ compiler failing to compile the code and crashing: this is a really old compiler (and is now no longer supported).

    There first thing I would try would be a completely clean rebuild: that sometimes helps (especially if you are using a PCH).

    If that doesn't work then you might want to try commenting out the offending line (or in this case lines) in afx.h and see if that helps.

  • Lexin Shan Customer Issue

    Thanks Ayman!

    Here's the error:

    c:\program files\microsoft visual studio\vc98\mfc\include\afx.h(438) : fatal error C1001: INTERNAL COMPILER ERROR
            (compiler file 'msc1.cpp', line 1786)
             Please choose the Technical Support command on the Visual C++
             Help menu, or open the Technical Support help file for more information

  • Alfonso Larriva

    Seams that either afxwin.h is not included before this part compiles.

  • Michael Sims

    You need to define DWORD:

    typedef unsigned long DWORD;

    and its in the windef.h

  • poulidis

    Could you post the exact error you are getting

    Thanks,
      Ayman Shoukry
      VC++ Team

  • juliomgm

    Thanks Ben, this worked.

    Now I have another problem.

    I get a fatal compile error.

    I checked the MS support link from MSDN and tried 2 of the 3 recommended fixes, i.e. Used Don not use precompiled header files and the /Zm1000 compiler switch.

    Neither worked.  Do You have any suggestions

  • JGHolmes

    Do I need afxwin.h in this case

    No MFC classes are used here even though this is an MFC app.

    Does this mean I need afxwin.h to use STL classes

  • Sanct

    Than include <WinDef.h> or <Windows.h>.

    Compiler complains that it does not know DWORD (and other similar types). Help says that this type is declared in <WinDef.h>.

    Thanks,
    Eugene



  • RapidLord

    Thanks, I'll give this a try.

    But, why would I need to do this.

    I understand DWORD needs to be defined, and I understand that it is defined in windef.h.

    My question is why would list.h, which is being compiled when I include queue.h, which are both part of the ANSII C++ STL be using a type defined in a Windows header file


  • Error including queue.h