Error: this declaration has no storage class or type specifier

This is a discussion on Error: this declaration has no storage class or type specifier within the C++ Programming forums, part of the General Programming Boards category; I am writing a code using Visual C++ to access serial port. Code is given below:- Code: HANDLE hSerial= CreateFile(L"COM1", ...

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    5

    Error: this declaration has no storage class or type specifier

    I am writing a code using Visual C++ to access serial port.


    Code is given below:-

    Code:
    HANDLE hSerial= CreateFile(L"COM1", GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
        DCB dcb = {0};
        dcb.DCBlength=sizeof(dcbSerialParams);
        dcb.BaudRate=CBR_1200;
        dcb.ByteSize=8;
        dcb.StopBits=ONESTOPBIT;
        dcb.Parity=NOPARITY;

    I am getting error in all last five lines in above code at dcb. and error is give below:-


    Error: this declaration has no storage class or type specifier


    I want to know where I am getting wrong and how to resolve this problem

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,393
    you need to be a little more specific on exactly which line it happens. perhaps give the definition of what a DCB is.

  3. #3
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,801
    Does your source file include the <windows.h> header?
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error: Missing type specifier
    By Litz in forum C++ Programming
    Replies: 6
    Last Post: 03-17-2009, 05:32 PM
  2. error: storage class specified for parameter
    By aim4sky in forum C Programming
    Replies: 20
    Last Post: 03-16-2009, 02:37 AM
  3. storage class specifier
    By -EquinoX- in forum C Programming
    Replies: 5
    Last Post: 11-06-2008, 03:07 PM
  4. Replies: 3
    Last Post: 07-08-2008, 10:01 AM
  5. Using string type in class for file storage
    By johnnyd in forum C++ Programming
    Replies: 9
    Last Post: 03-11-2003, 11:11 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21