top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

When does compilation give such type of errors: "error: expected ')' before '*' token"?

+4 votes

What may be the possible reason behind it ?

posted Oct 7, 2014 by Harshita

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+2 votes

Compiler generates this error only & only if it does not recognize the datatype that you have mentioned in the arguments to your function I assume.

For example -->
int example(int *x,int *y) is correct.

int example(integer *x, int *y) will generate the above error because the compiler does not recognize the datatype of argument 1, i.e. integer.

If you are using some sort of typedef, just verify if you have included the respective header file in which the datatype/structure is defined. That should fix this error.

answer Oct 7, 2014 by Ankush Surelia
Thanks Ankush for clarification.
Welcome Harshita :-)
+1 vote

I have faced same type of error few days back while compiling my code using gcc compiler.
As per my observation, it comes when you use a data structure and that is not defined within the code base.
I am not sure, there may be other couple of reasons that through such type of errors.

answer Oct 7, 2014 by Ganesh
Similar Questions
+3 votes

I am newbie to C and getting the compilation error in the following function.

int get_names(int students, char names[students][20])
        int i;
        for (i = 0; i < students; ++i)
                printf("Enter name for Student %d: ", i);
                scanf("%s", names[i]);
        return char names[students];


return char names[students];
error: expected expression before 'char'
+2 votes

I need to use microhttpd.a and pthread.a to build a cross-compiled program to be deployed on an arm-linux-gnueabihf device.

Where can I find instructions on how to do this? Or, is this simply a matter of downloading the source code and compiling (on a 64 bit UbuntuPC) to a library with my existing gcc-arm-linux-gnueabihf-4.8 cross-compiler?

While I may be able to find microhttpd.a and pthread.a binaries for an arm-linux-gnueabihf device, they will likely have been built with a different version of gcc-arm-linux-gnueabihf, which, I fear, could open up a can of worms.

+2 votes

I have very high and limited knowledge of compiler's functionality.
As per my knowledge, Compiler does it's job using following steps:
1. Lexical analysis
2. Syntactic analysis
3. Semantic analysis
4. Pre-optimization of internal representation.
5. Code generation
6. Post optimization.

Can some one please explain about 4, 5 and 6 steps ? What they signify ?

+3 votes

Is there any way to get the original source code from binary ?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.