Weird Syntax Error in PSoC Creator IDE

Discussion of the PSoC Creator Integrated Development Environment for PSoC3 & PSoC5 devices.

Moderator: ericb

Weird Syntax Error in PSoC Creator IDE

Postby vgptgupta » Thu Jul 18, 2013 2:34 am

Please help.
I'm getting the following error

ERROR: .\main.c:1: syntax error near '#'
ERROR: .\main.c:1: missing ';' before '<'
The command 'c51.exe' failed with exit code '2'.


But there is nothing on the line 1 except the comments.
Please help.

I've uploaded the main.c file.
Attachments
main.c
main.c file
(7.2 KiB) Downloaded 111 times
vgptgupta
Newbie
Newbie
 
Posts: 2
Joined: Thu Jul 18, 2013 2:27 am

Re: Weird Syntax Error in PSoC Creator IDE

Postby danadak » Thu Jul 18, 2013 8:29 am

I have had errors reported on a line that make no sense. Invariably it is somwhere
else in code, so fast way to find out is comment out whole sections to narrow down
its origin.

If you post the whole project forum can try to help.


Regards, Dana.
Field Application Engineer
KB1RHB Mostly listen :)
Semi Retired
User avatar
danadak
The Big Cheese
The Big Cheese
 
Posts: 2008
Joined: Thu Dec 27, 2007 8:42 am
Location: New Hampshire

Re: Weird Syntax Error in PSoC Creator IDE

Postby neilt » Thu Jul 18, 2013 8:34 am

The source file has CR line endings ("Mac" format). The C51 compiler only recognizes LF ("Unix" format) and CR-LF ("DOS" format) line endings, so it interprets the entire source file as a single line of text. Whitespace and comments are allowed before the '#' in a preprocessor directive, but C51 does not recognize the CR line endings as whitespace so it reports a syntax error. Converting the line endings to LF or CR-LF using unix2dos or a programming-oriented text editor should allow the compiler to read the source file correctly.
neilt
Newbie
Newbie
 
Posts: 3
Joined: Thu Dec 22, 2011 1:37 pm

Re: Weird Syntax Error in PSoC Creator IDE

Postby danadak » Sat Jul 20, 2013 7:40 am

@neilt, I would not have found that error in a lifetime, my hats off to you
on this one.

I have been fortunate to have a career where I have learned more from the
customers than they me.

Regards, Dana.
Field Application Engineer
KB1RHB Mostly listen :)
Semi Retired
User avatar
danadak
The Big Cheese
The Big Cheese
 
Posts: 2008
Joined: Thu Dec 27, 2007 8:42 am
Location: New Hampshire

Re: Weird Syntax Error in PSoC Creator IDE

Postby vgptgupta » Thu Jul 25, 2013 12:41 am

Thanks for the reply guys.

Turns out that I was replacing the generated main.c file with my own main.c file which i wrote in notepad++. So, after just copy pasting the code from my main.c file to generated one, it compiled without any error.
vgptgupta
Newbie
Newbie
 
Posts: 2
Joined: Thu Jul 18, 2013 2:27 am

Re: Weird Syntax Error in PSoC Creator IDE

Postby KennyMillar » Fri Sep 27, 2013 1:28 am

vgptgupta wrote:...which i wrote in notepad++.

I don't blame you! I too use an external editor.
Goodness knows why Cypress thought we needed a proprietary IDE, building the schematic and design rules editors into NetBeans or Eclipse would have been quicker and easier and cheaper, and it would have run on Mac OS X too.

I hang onto a Windows Laptop purely for PSoC Creator, all my other design tools now run on Mac: Eagle, MPLAB (PIC and dsPIC), ARM, MBED .....
KennyMillar
Cheese Wheel
Cheese Wheel
 
Posts: 60
Joined: Mon Jan 17, 2011 7:34 am


Return to “%s” PSoC Creator (PSoC3 & PSoC5 IDE)

Who is online

Users browsing this forum: No registered users and 1 guest