Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm new to Linux and I need some help!

I am trying to compile the code taken from this post to the linux-kernel mailing list.

I have pasted the file into Libre Office and saved it as pairing_tool.c (Not as pairing_tool.c.odt. I have renamed the file to pairing_tool.c.)

But when I use this command line: gcc -o pairing_tool pairing_tool.c in the terminal, I get many errors.

  • What did I do wrong?
  • Should I paste the text into a special text editor?

Also just to be clear, I've used the text included only in between

#include <linux/input.h>

and

return 0;
}

So I haven't put the comments. I think it is good this way, is it?

share|improve this question
    
If you are at all curious as to why using Libre Office did not work, then all you have to do is (1) create the file again by pasting into Libre Office and then saving it as (for example) trythis.c. (2) Open trythis.c with the gedit text edit. I think you will immediately understand why you had so many compile errors. –  irrational John Jun 6 '12 at 0:41
add comment

1 Answer

up vote 3 down vote accepted

Yes, you should use a text editor, for example gedit which is installed in Ubuntu by default. LibreOffice Writer is a text processor and it saves its files with some additional markup which C compiler does not understand.

To run gedit, press the Super (Win logo) key and type "gedit".

Apart from saving the program in plain text format, you will also need to install the C compiler and stuff, which you can do with

sudo apt-get install build-essential

(although I think you already managed to install it)

Btw, I can confirm that the program compiles nicely and even runs after that :)

share|improve this answer
    
oki ;) solved!! –  simon Jun 5 '12 at 18:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.