Thread: ras.h errors

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    18

    ras.h errors

    I am trying to compile the following code:

    Code:
    #include <ras.h>
    
    
    bool IsConnected()
    {
       LPRASCONN TRasCon;
       RASCONNSTATUS Tstatus;
    
       DWORD lg;
       DWORD lpcon;
       bool lReturn;
    
       TRasCon->dwSize = 412;
       lg = 256 * TRasCon->dwSize;
       lReturn = false;
    
       if( RasEnumConnections(TRasCon, &lg, &lpcon) == 0 )
       {
           Tstatus.dwSize = 160;
           RasGetConnectStatus(TRasCon->hrasconn, &Tstatus);
    
           lReturn = ( Tstatus.rasconnstate == 0x2000 );
       }
    
       return( lReturn );
    }
    And I get the following errors:

    c:\program files\microsoft visual studio\vc98\include\ras.h(47) : error C2065: 'HRASCONN' : undeclared identifier
    c:\program files\microsoft visual studio\vc98\include\ras.h(47) : error C2501: 'DECLARE_HANDLE' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(56) : error C2146: syntax error : missing ';' before identifier 'dwSize'
    c:\program files\microsoft visual studio\vc98\include\ras.h(56) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(56) : error C2501: 'dwSize' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(57) : error C2146: syntax error : missing ';' before identifier 'hrasconn'
    c:\program files\microsoft visual studio\vc98\include\ras.h(57) : error C2501: 'HRASCONN' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(57) : error C2501: 'hrasconn' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(58) : error C2146: syntax error : missing ';' before identifier 'szEntryName'
    c:\program files\microsoft visual studio\vc98\include\ras.h(58) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(58) : error C2501: 'szEntryName' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(73) : error C2146: syntax error : missing ';' before identifier 'dwSize'
    c:\program files\microsoft visual studio\vc98\include\ras.h(73) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(73) : error C2501: 'dwSize' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(74) : error C2146: syntax error : missing ';' before identifier 'hrasconn'
    c:\program files\microsoft visual studio\vc98\include\ras.h(74) : error C2501: 'HRASCONN' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(74) : error C2501: 'hrasconn' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(75) : error C2146: syntax error : missing ';' before identifier 'szEntryName'
    c:\program files\microsoft visual studio\vc98\include\ras.h(75) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(75) : error C2501: 'szEntryName' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(154) : error C2146: syntax error : missing ';' before identifier 'dwSize'
    c:\program files\microsoft visual studio\vc98\include\ras.h(154) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(154) : error C2501: 'dwSize' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(156) : error C2146: syntax error : missing ';' before identifier 'dwError'
    c:\program files\microsoft visual studio\vc98\include\ras.h(156) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(156) : error C2501: 'dwError' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(157) : error C2146: syntax error : missing ';' before identifier 'szDeviceType'
    c:\program files\microsoft visual studio\vc98\include\ras.h(157) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(157) : error C2501: 'szDeviceType' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(158) : error C2146: syntax error : missing ';' before identifier 'szDeviceName'
    c:\program files\microsoft visual studio\vc98\include\ras.h(158) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(158) : error C2501: 'szDeviceName' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(167) : error C2146: syntax error : missing ';' before identifier 'dwSize'
    c:\program files\microsoft visual studio\vc98\include\ras.h(167) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(167) : error C2501: 'dwSize' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(169) : error C2146: syntax error : missing ';' before identifier 'dwError'
    c:\program files\microsoft visual studio\vc98\include\ras.h(169) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(169) : error C2501: 'dwError' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(170) : error C2146: syntax error : missing ';' before identifier 'szDeviceType'
    c:\program files\microsoft visual studio\vc98\include\ras.h(170) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(170) : error C2501: 'szDeviceType' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(171) : error C2146: syntax error : missing ';' before identifier 'szDeviceName'
    c:\program files\microsoft visual studio\vc98\include\ras.h(171) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(171) : error C2501: 'szDeviceName' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(193) : error C2146: syntax error : missing ';' before identifier 'dwSize'
    c:\program files\microsoft visual studio\vc98\include\ras.h(193) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(193) : error C2501: 'dwSize' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(194) : error C2146: syntax error : missing ';' before identifier 'szEntryName'
    c:\program files\microsoft visual studio\vc98\include\ras.h(194) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(194) : error C2501: 'szEntryName' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(195) : error C2146: syntax error : missing ';' before identifier 'szPhoneNumber'
    c:\program files\microsoft visual studio\vc98\include\ras.h(195) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(195) : error C2501: 'szPhoneNumber' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(196) : error C2146: syntax error : missing ';' before identifier 'szCallbackNumber'
    c:\program files\microsoft visual studio\vc98\include\ras.h(196) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(196) : error C2501: 'szCallbackNumber' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(197) : error C2146: syntax error : missing ';' before identifier 'szUserName'
    c:\program files\microsoft visual studio\vc98\include\ras.h(197) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(197) : error C2501: 'szUserName' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(198) : error C2146: syntax error : missing ';' before identifier 'szPassword'
    c:\program files\microsoft visual studio\vc98\include\ras.h(198) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(198) : error C2501: 'szPassword' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(199) : error C2146: syntax error : missing ';' before identifier 'szDomain'
    c:\program files\microsoft visual studio\vc98\include\ras.h(199) : error C2501: 'WCHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(199) : error C2501: 'szDomain' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(209) : error C2146: syntax error : missing ';' before identifier 'dwSize'
    c:\program files\microsoft visual studio\vc98\include\ras.h(209) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(209) : error C2501: 'dwSize' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(210) : error C2146: syntax error : missing ';' before identifier 'szEntryName'
    c:\program files\microsoft visual studio\vc98\include\ras.h(210) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(210) : error C2501: 'szEntryName' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(211) : error C2146: syntax error : missing ';' before identifier 'szPhoneNumber'
    c:\program files\microsoft visual studio\vc98\include\ras.h(211) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(211) : error C2501: 'szPhoneNumber' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(212) : error C2146: syntax error : missing ';' before identifier 'szCallbackNumber'
    c:\program files\microsoft visual studio\vc98\include\ras.h(212) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(212) : error C2501: 'szCallbackNumber' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(213) : error C2146: syntax error : missing ';' before identifier 'szUserName'
    c:\program files\microsoft visual studio\vc98\include\ras.h(213) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(213) : error C2501: 'szUserName' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(214) : error C2146: syntax error : missing ';' before identifier 'szPassword'
    c:\program files\microsoft visual studio\vc98\include\ras.h(214) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(214) : error C2501: 'szPassword' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(215) : error C2146: syntax error : missing ';' before identifier 'szDomain'
    c:\program files\microsoft visual studio\vc98\include\ras.h(215) : error C2501: 'CHAR' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(215) : error C2501: 'szDomain' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(238) : error C2146: syntax error : missing ';' before identifier 'dwSize'
    c:\program files\microsoft visual studio\vc98\include\ras.h(238) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(238) : error C2501: 'dwSize' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(239) : error C2146: syntax error : missing ';' before identifier 'dwfOptions'
    c:\program files\microsoft visual studio\vc98\include\ras.h(239) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(239) : error C2501: 'dwfOptions' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(240) : error C2146: syntax error : missing ';' before identifier 'hwndParent'
    c:\program files\microsoft visual studio\vc98\include\ras.h(240) : error C2501: 'HWND' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(240) : error C2501: 'hwndParent' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(241) : error C2146: syntax error : missing ';' before identifier 'reserved'
    c:\program files\microsoft visual studio\vc98\include\ras.h(241) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(241) : error C2501: 'reserved' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(270) : error C2146: syntax error : missing ';' before identifier 'dwSize'
    c:\program files\microsoft visual studio\vc98\include\ras.h(270) : error C2501: 'DWORD' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(270) : error C2501: 'dwSize' : missing storage-class or type specifiers
    c:\program files\microsoft visual studio\vc98\include\ras.h(270) : fatal error C1003: error count exceeds 100; stopping compilation
    Error executing cl.exe.

    This make it look like there is a problem with ras.h, I also tried compiling this in LCC W32 and it highlighted things in ras.h, and both MSVC++ and LCC W32 use different ras.h files...
    Please help...

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Hmm...try including windows.h before ras.h?

    Code:
    #include <windows.h>
    #include <ras.h>

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    18
    Now I'm getting the errors:

    isconnected.obj : error LNK2001: unresolved external symbol _RasGetConnectStatusA@8
    isconnected.obj : error LNK2001: unresolved external symbol _RasEnumConnectionsA@12
    Debug/isconnected.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.
    Sorry for bothering you.

  4. #4
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,273
    Tell your linker to link to rasapi32.lib

    Project->Settings->Link->Object/library modules

  5. #5
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    it looks like you are getting cascading errors from as few as one or two errors, make sure you are linking with everything you need to and you don't have a misplaced ; or }

    EDIT: sorry, didn't see your first problem was fixed

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    18
    Thank you very much guys

  7. #7
    Registered User
    Join Date
    Jul 2005
    Posts
    7
    I'd reccomend trying http://bloodshed.net/, my school used MSVC, and I hated it.

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    18
    How would I go about writing a prototype for

    bool IsConnected()

    I've tried

    bool IsConnected();

    But it gives me errors, I have experiencing making prototypes for bool functions....I've never used boolean functions before...

  9. #9
    Registered User
    Join Date
    Jul 2005
    Posts
    7
    Code:
    bool myfunc();
    
    
    /*Make sure this function is after the prototype*/
    bool myfunc(){
    /*code*/
    }
    you may need a
    Code:
    typedef int short unsigned bool;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  3. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 08:00 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 06:51 PM