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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-10-2005, 08:38 PM
|
#1
|
Member
Registered: Oct 2004
Location: columbus oh
Distribution: mepis
Posts: 109
Rep:
|
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
|
|
|
05-10-2005, 08:49 PM
|
#2
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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
|
|
|
05-10-2005, 09:19 PM
|
#3
|
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Rep: 
|
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"...
|
|
|
05-10-2005, 09:22 PM
|
#4
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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
|
|
|
05-10-2005, 10:03 PM
|
#5
|
Member
Registered: Oct 2004
Location: columbus oh
Distribution: mepis
Posts: 109
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 06:14 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|