Help Unknown Syntax Error | Unix Linux Forums | Programming

  Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Help Unknown Syntax Error

Programming


Tags
syntax, syntax error, unexpected token

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 10-09-2012
apolo93 apolo93 is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 9 October 2012, 10:55 PM EDT
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Help Unknown Syntax Error

Please excuse me if this is an easy fix, for I am new to Unix and C


Code:
'/problem1.c: line2: syntax error near unexpected token `
'/problem1.c: line2: `main()

and for one program it has


Code:
: command not found2: (above the syntax error)

As mentioned this is in C not C++, I have complied all four programs and nothing is brought up however when I try to execute it Unix displays what the picture above shows. I am unaware as to what this warning/error is, please help.

Thank you

Last edited by Scott; 10-10-2012 at 01:24 AM.. Reason: Code tags
Sponsored Links
    #2  
Old 10-09-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 26 November 2014, 5:04 PM EST
Location: Saskatchewan
Posts: 19,943
Thanks: 848
Thanked 3,420 Times in 3,205 Posts
It sounds like you've jammed C dode into a script file and tried to run it. C is not a script. Compiling .c files generates a new file, that is the file you run.
Sponsored Links
    #3  
Old 10-09-2012
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 26 November 2014, 11:20 PM EST
Location: NM
Posts: 10,282
Thanks: 288
Thanked 815 Times in 757 Posts
You cannot run the file named: problem1.c

Here is how you do it. gcc or cc is your compiler command - you should know which one to use.

Code:
cc problem1.c -o problem1
./problem1

./problem1 runs the compiled code, and is the compiled code. It will run only when you see no errors from the compiler.

This is probably homework, but I did nothing your teacher should and probably has already done for you. Please post homework in the homework forum.
The Following User Says Thank You to jim mcnamara For This Useful Post:
apolo93 (10-09-2012)
    #4  
Old 10-09-2012
apolo93 apolo93 is offline
Registered User
 
Join Date: Oct 2012
Last Activity: 9 October 2012, 10:55 PM EDT
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Thank you Jim, I mean that. Ive been trying to figure this out all day.

This is homework, my teacher did go over this and I do apologize for posting it here, I'm new to the site and did not see the homework forum.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unknown error - ``' unmatched ajincoep Shell Programming and Scripting 7 09-01-2010 02:00 AM
FIFO possible blocking or unknown error Ebodee Homework & Coursework Questions 1 08-12-2010 08:04 PM
syntax error in shell test: unknown operator shellscripter Shell Programming and Scripting 4 03-31-2009 04:28 AM
Unknown File Type error rohitsz Solaris 3 07-15-2007 06:57 PM
Error: unknown pseudo-op: `.weakref' napapanbkk Programming 6 06-16-2006 10:32 AM



All times are GMT -4. The time now is 05:19 AM.