Thread: expected primary-expression before xxx token

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    159

    expected primary-expression before xxx token

    hi,
    I got this "expected primary-expression before xxx token" error from my code
    Code:
    svm_learn_classification(_docs,_target,nb_examples,dim,&_learn_parm, &_kernel_parm,kernel_cache,_model,NULL); //error: expected primary-expression before ‘,’ token
    if(kernel_cache) kernel_cache_cleanup(kernel_cache); // error: expected primary-expression before ‘)’ token // error: expected primary-expression before ‘)’ token
    What mistake might cause the problem?
    Thanks and regards!
    Last edited by lehe; 07-06-2009 at 10:43 AM.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    there doesn't appear to be anything syntactically wrong with those two lines. When I get errors like that, it's usually because I forgot a closing brace or a semicolon on a previous line.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    There can be a number of problems, such as some variables not existing or conflicting macros.
    Hack up the code into pieces, removing variables until you get it working.
    Then you'll have a better idea on what's wrong.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Any chance that one of these names is a macro that expands to nothing? kernel_cache is the prime candidate, since it's the only thing that appears on both lines.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    159
    Thanks!
    kernel_cache has been defined in a library header file as a struct type name, so it better not to be used as the name of a pointer here.
    Code:
    typedef struct kernel_cache {
    ...
    } KERNEL_CACHE;

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    A type even...
    This only strengthens the belief that there should be naming rules. Different ways of naming types, variables, functions and types.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM