Thread: Compiling problem

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

    Compiling problem

    I'm having an error while compiling my C++ program:
    error: expected ')' before "void"
    Here is the code where the error is happening:
    Code:
    int main ()
    {
        int pvr;
    
        if ( pvr void init_pvr() true);
        {
            return 0;
        }
        if ( pvr void init_pvr() false);
    }
    Help? Inserting ")" before "void" won't work.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I guess the question is -- what do you think "pvr void init_pvr() true" is supposed to mean? I mean, this isn't postscript or some stack based language. If you want to pass pvr to the function init_pvr, you put it inside the parentheses. And you can't compare with true, since apparently the function is void, which means it doesn't return anything, let alone true or false.

  3. #3
    Registered User
    Join Date
    Feb 2009
    Posts
    5
    Alright, I removed the "int pvr". Now I get PLUS 1 error:
    error: expected primary-experession before "void"

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I would hope so. You don't use void when you call functions either, just like you don't always talk about "int pvr" when you use the variable, etc.

  5. #5
    Registered User
    Join Date
    Feb 2009
    Posts
    5
    Oh wait... I think I don't need this "if" stack anymore, because if PVR graphics chip isn't working the error message won't display! I'm so stupid.

  6. #6
    Registered User
    Join Date
    Feb 2009
    Posts
    5
    Alright, I'm having issues in compiling, this time in a required area.
    I get the following errors:
    error: redefinition of 'struct maple_devinfo
    error: previous definition of 'struct maple_devinfo
    error: new declaration of 'void maple_init
    error: ambiguates old declaration 'int maple_init'

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    1) You are trying to create 2 types of struct blueprints with the same name. Illegal.
    2) You are trying to overload functions only based on the return type. Illegal.
    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.

  8. #8
    Registered User
    Join Date
    Feb 2009
    Posts
    5
    Quote Originally Posted by Elysia View Post
    1) You are trying to create 2 types of struct blueprints with the same name. Illegal.
    2) You are trying to overload functions only based on the return type. Illegal.
    So what should I do? :S

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Depends on what you are trying to do.
    As I said, you cannot have two structs that have the same name.
    And you cannot have 2 or more functions with the same name when they only differ with the return type. If they have different parameter lists, it's legal, but otherwise not.
    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.

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Hmm. Is this for a PVR as in Imagination Technologies PVR?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Running Program After Compiling
    By kristentx in forum C++ Programming
    Replies: 13
    Last Post: 09-12-2007, 10:46 AM
  2. Problem compiling simple code examples
    By Wintersun in forum Windows Programming
    Replies: 8
    Last Post: 08-14-2007, 10:30 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. compiling problem
    By tinkerbell20 in forum C++ Programming
    Replies: 6
    Last Post: 06-21-2005, 12:12 PM
  5. simple compiling problem
    By waxydock in forum C++ Programming
    Replies: 2
    Last Post: 03-26-2005, 10:33 AM