LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 05-10-2005, 08:38 PM   #1
davidleroux1
Member
 
Registered: Oct 2004
Location: columbus oh
Distribution: mepis
Posts: 109

Rep: Reputation: 15
compile errors


I wrote a one page program and ran in gcc but I got two warnings.
the program runs but was wondering what are the warning for.

first is a line of code.

printf(( " Calculated enthalpy is %d btu per\lb\n",enth));

enthalpy.c:74:15: warning: unknown escape sequence '\l'


then here is the other warning.

enthalpy.c:110:6: warning: no newline at end of file

here is my end of file

printf( " \n");
printf( " \n");

return 0;
}

I am new to writing programs
 
Old 05-10-2005, 08:49 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Re: compile errors

Quote:
Originally posted by davidleroux1
printf(( " Calculated enthalpy is %d btu per\lb\n",enth));
enthalpy.c:74:15: warning: unknown escape sequence '\l'
For a literal \ you'd need a \\ ...


Quote:
enthalpy.c:110:6: warning: no newline at end of file

here is my end of file

printf( " \n");
printf( " \n");

return 0;
}
Just press enter behind the closing }


Cheers,
Tink
 
Old 05-10-2005, 09:19 PM   #3
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Minor clarification...

Hi -

Tinkster is 100% correct. But just to clarify a bit:

1. Escape sequence:
printf(( " Calculated enthalpy is %d btu per\lb\n",enth));
enthalpy.c:74:15: warning: unknown escape sequence '\l'

C/C++ (and Java and C#) have a notion of "escape characters": special
codes like '\t' (tab), '\b' (backspace), '\n' (newline in Unix, CR/LF in DOS), and so forth.

There are a fixed, predefined set of these escapes, and the compiler message
is a complaint telling you "\lb" isn't one of them.

So the question is "What did you *intend* to do?"

If you wanted to print the text "per\lb", then Tinkster's advice is correct:

printf(( " Calculated enthalpy is %d btu per\\lb\n",enth));
<= THE "\\" SYNTAX ESCAPES THE ESCAPE CHARACTER, GIVING YOU A SINGLE "\"

2. End of file:
Many (although not necessarily all) C/C++ compilers demand a "\n" (linefeed, or CR/LF) after
the last line of code. So it's always good practice to put an explicit line or two after the last line in your source file. Tinkster said "before" the brace; I think he meant "after"...
 
Old 05-10-2005, 09:22 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Re: Minor clarification...

Quote:
Originally posted by paulsm4
Tinkster said "before" the brace; I think he meant "after"...
Actually I said behind which is close enough to after ;)


Cheers,
Tink
 
Old 05-10-2005, 10:03 PM   #5
davidleroux1
Member
 
Registered: Oct 2004
Location: columbus oh
Distribution: mepis
Posts: 109

Original Poster
Rep: Reputation: 15
thanks

isee about the \lb .
i do want to make it btu\lb
so i'll just make it btu\\lb

thanks and
i thought i tried to add a space after the }

anyways i will check that again

thanks all
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compile errors. DrunkenDisciple Linux - Software 3 11-29-2005 12:11 AM
c++ compile errors using g++ ttumelty Programming 5 09-08-2005 01:58 PM
C++ compile errors Palamides Programming 1 03-09-2005 06:28 AM
Ndiswrapper Compile Errors ne2007ber Linux - Software 1 01-09-2005 02:33 PM
Compile Errors userini Linux - Software 6 07-16-2003 08:22 AM


All times are GMT -5. The time now is 12:50 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration