Jump to content

Missing Right Parenthesis

Recommended Posts

Greetings Everyone,


I am trying to get this small piece of code to compile but keep getting the errors shown below:



source.c(25): error: missing right paren

source.c(25): error: general error

source.c(25): error: failure




#include <system.h>


/* Target PIC16F877 configuration word. */





/* Set clock frequency to 16MHz. */

#pragma CLOCK_FREQ 16000000



void main(void) {



// File scope objects.

short unsigned word_1; //

short unsigned word_2; //

short unsigned word_3; //

short unsigned word_4; //


/* Initialise array. */

unsigned char map[8] = {0x01, 0x03, 0x15, 0x3C, 0xFF, 0xAA, 0x0F, 0xC8};



/* Program loop. */

while(1); {


asm nop //


/* Expression 1. */

word_1 = ((short) map[1]) << 8 | map[5]; //


asm nop //


/* Expression 2 */

word_2 = (short) map[1]; //

word_2 = (word_2 << 8) | map[5]; //


asm nop //

/* Expression 3 */

word_3 = (short) map[1]; //

word_3 = word_3 << 8; //

word_3 = word_3 | map[5]; //


asm nop //


/* Expression 4 */

word_4 = (((short) map[1]) << 8) | map[5]; //






The error occurs at "void main(void)" so I suspect the preprocessor has found something wrong but I cannot see what the problem is.


I have tried putting the preprocessor statements in the "main" function, commenting them out and removing them completely but I cannot resolve this problem. I am sure the explanation will be very obvious when it is pointed-out to me.


Compiler BoostC v7.05




Thanks in advance for any possible help with this.



Share this post

Link to post
Share on other sites

Thanks AlexR did not notice the semicolon had crept in there spent almost two days not noticing that.


Thank you.


Share this post

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...