Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: [C] let op: geen newline aan einde van bestand  (gelezen 965 keer)

Offline Joshua822

  • Lid
[C] let op: geen newline aan einde van bestand
« Gepost op: 2009/08/15, 23:28:39 »
Hallo allemaal.

Al een tijdje, krijg ik bij eender welke code die ik compileer, deze melding :

Citaat
binary_tree.c:75:3: let op: geen newline aan einde van bestand

Ik gebruik muispad de kleine tekst editor van xfce.

Alvast bedankt.

Offline profoX

  • Lid
    • wesley
    • Lionslink
Re: [C] let op: geen newline aan einde van bestand
« Reactie #1 Gepost op: 2009/08/16, 00:04:11 »
simpel, gewoon een lege lijn achteraan je bestand laten :)

en waarom? dat vroeg ik me ook af, maar hier vond ik een nuttig antwoord:
http://stackoverflow.com/questions/72271/no-newline-at-end-of-file-compiler-warning
Citaat
Think of some of the problems that can occur if there is no newline. According to the ANSI standard the #include of a file at the beginning inserts the file exactly as it is to the front of the file and does not insert the new line after the "#include " after the contents of the file. So if you include a file with no newline at the end to the parser it will be viewed as if the last line of foo.h is on the same line as the first line of foo.cpp. What if the last line of foo.h was a comment without a new line? Now the first line of foo.cpp is commented out. These are just a couple of examples of the types of problems that can creep up.
-- Of course in practice every compiler adds a new line after the #include. Thankfully.
« Laatst bewerkt op: 2009/08/16, 00:06:16 door profoX »
Human Knowledge Belongs To The World -- Antitrust (2001)
Nederlandstalige Ubuntu documentatie van Ubuntu-NL (wiki)

Offline Joshua822

  • Lid
Re: [C] let op: geen newline aan einde van bestand
« Reactie #2 Gepost op: 2009/08/16, 00:15:10 »
Bedankt profoX.

Ik moest met nano de newline toevoegen. Nu krijg ik de melding niet meer.