Thread: strange ERROR

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    222

    Thumbs up strange ERROR

    I get this error while compiling in gCC

    Code:
     
    error: expected â:â, â,â, â;â, â}â or â__attribute__â before â=â token
    
    
     the error occurs at below line
    CH_FREQ_MAP CH_HZ_ID_MAP[]=
    		{
    			{1, 2412},
    			{2, 2417},
    			{3, 2422},
    			{4, 2427},
    			{5, 2432},
    			{6, 2437},
    			{7, 2442},
    			{8, 2447},
    			{9, 2452},
    			{10, 2457},
    			{11, 2462},
    			{12, 2467},
    			{13, 2472},
    			{14, 2484},
    };

  2. #2
    Registered User javaeyes's Avatar
    Join Date
    Feb 2012
    Posts
    153
    I could be wrong here, but try removing the final , after
    Code:
    {14, 2484}, //TRY REMOVING THIS COMMA,

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by leo2008
    I get this error while compiling in gCC
    I suggest that you also post the code before the snippet of code that you posted.

    Quote Originally Posted by javaeyes
    try removing the final ,
    The trailing comma should be fine in this case.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Nov 2008
    Posts
    222
    Quote Originally Posted by javaeyes View Post
    I could be wrong here, but try removing the final , after
    Code:
    {14, 2484}, //TRY REMOVING THIS COMMA,
    I tried it still gives the same error.

  5. #5
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    You already have a thread on the same thing and you have been told repeatedly nobody can help you without complete code. Yet, you continue to post extracts of ambiguous error messages followed by what "YOU THINK" is where the problem is.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well having looked at your IP address, I'm rather of the opinion that you've just started work at a new company (possibly your first job) and you're hopelessly out of your depth.

    Looking at your post history here (from years ago), I see
    One post on Win32 gui for win32 c++ programming
    One post on GUI in Linux GUI using C in LINUX
    And a handful of C# threads.

    None of this would in any way prepare you for Linux kernel driver hacking.
    fxr.watson.org: linux-2.6 sys/drivers/staging/rt3090/common/rt_channel.c

    Now whilst you may eventually stumble towards making it compile, you can be pretty sure that you will have broken something along the way.
    Now if you think getting a driver to compile was hard, just wait until you try to debug the damn thing!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    ouch!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with strange error
    By fabriciomind in forum C Programming
    Replies: 2
    Last Post: 06-03-2011, 06:28 AM
  2. Strange Error. . .
    By Kennedy in forum C Programming
    Replies: 6
    Last Post: 08-14-2009, 04:39 PM
  3. Strange error I have not gotten before.
    By tameeyore in forum C Programming
    Replies: 3
    Last Post: 09-16-2005, 11:36 AM
  4. Strange Error
    By tyler4588 in forum C++ Programming
    Replies: 2
    Last Post: 07-23-2003, 07:02 PM
  5. strange error!?
    By pode in forum Game Programming
    Replies: 3
    Last Post: 12-26-2002, 12:17 PM