Advertisement

compiling\linking problems

Started by June 20, 2004 08:51 AM
8 comments, last by Bruno 20 years, 3 months ago
Hi., This is kind of a weird error, but it's probably because i'm a really new in linux. I made a project in Mandrake 8.2 at my home, and everything compiles and runs fine here. However, i'm unable to compile it in Fedora , it gives me this error : In file included from main.c:1: localtr.h:24:11: warning: no newline at end of file main.c:19:10: missing terminating " character main.c: In function `main': main.c:20: error: syntax error before "servir" main.c:20:8: missing terminating " character Any ideia on what could the error be ? thanks, Bruno
Can we see around lines 19&20 of main.c ?
Advertisement
sure thing,


printf("Por favor introduza o numero de clientes que pretende
servir:");

That's line 19 and 20.
I have the feeling that if i leave everything in the same line, the compile will succed.
However, isn't gcc the same in any linux system ?
In any compiler on any OS you need to put a \ to put strings on more than one line. That's definitely you're problem.
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
Quote: Original post by clum
In any compiler on any OS you need to put a \ to put strings on more than one line. That's definitely you're problem.


If that \ is the problem, why don't i have any compile errors in my mandrake system ?
It shouldn't compile in the Mandrake system either. Are you sure you're using the same source? If the exact same code works in your Mandrake system, then there's something wrong with your Mandrake system.
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
Advertisement
It'ds probably not the same line. That look vaguely like a column wrap, which some STUPID MORONIC text editors will do automatically and not tell you about...
Sometimes you need to place a \n (or just hit ENTER on the keyboard) at the end of the file. In Bruno's case, just hammer ENTER a couple of times after the code

printf("Por favor introduza o numero de clientes que pretende servir:");/* Begin wild enter bashing on keyboard now*/
Quote: Original post by Clash Rocker
Sometimes you need to place a \n (or just hit ENTER on the keyboard) at the end of the file. In Bruno's case, just hammer ENTER a couple of times after the code

*** Source Snippet Removed ***


That might fix the "localtr.h:24:11: warning: no newline at end of file" message (assuming you add the newline to localtr.h), but that's not what's causing the errors.

Having a literal newline in the middle of a string is a bad idea, and, as it seems, non-standard. Better to do this:
printf("blah blah blah blah "       "blah blah blah");

The compiler will concatenate the two strings and treat them as if they are just one single string. If you want a newline in the string, throw in a '\n' at the end of the first line.
My stuff.Shameless promotion: FreePop: The GPL god-sim.
The source was actually written in Windows notepad, and saved as .txt, wich i later emailed it to myself.
Then in linux, i opened the email, and copy\paste the source to Kdeveloper.
This compiled ok in mandrake, but maybe the file got screwed up and in fedora is more sensible.

thanks for the suggestions, i'l try them.

Bruno

This topic is closed to new replies.

Advertisement