Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've written a simple C program that uses the GTK+ visual interface (I can post the code if it's relevant). I can compile it without erros or warnings using:

gcc -c s9p2.c 
pkg-config --cflags glib-2.0
pkg-config --cflags gtk+-2.0

Where s9p2.c is the program name. However, when I try to run the program I get this:

bash: ./s9p2: No such file or directory

I have checked with the ls command and the file is in fact there. I have also tried to install. I have tried googling for a solution, and one that came up was to install the ia32-libs package. I did that, but it did not work.

I would appreciate any help. Please forgive me if I was not clear.

EDIT: As asked, this is the output of ls -l s9p2* is:

-rw-rw-r-- 1 francisco francisco 2492 Jan  3 19:11 s9p2.c
-rw-rw-r-- 1 francisco francisco 6616 Jan  3 21:13 s9p2.o
share|improve this question
Does this help? Unable to run a 32-bit program on 64-bit VM – minerz029 Jan 3 '14 at 21:20
Please add the output of ls -l s9p2* to your question. – Florian Diesch Jan 3 '14 at 21:21
up vote 1 down vote accepted

Your main error is adding the -c flag to your command - that tells gcc to compile the source file (producing an object code file s9p2.o) but stop short of linking it with the libraries necessary to create an executable program (s9p2)

The correct command should be something like

gcc -o s9p2 `pkg-config --cflags glib-2.0` s9p2.c `pkg-config --libs gtk+-2.0`


gcc -o s9p2 s9p2.c `pkg-config --cflags --libs gtk+-2.0`
share|improve this answer
Yes, that worked. Thank you! – user2949903 Jan 3 '14 at 23:49

First the c file is not the program, the binary executable which should be called s9p2 (no extension) unless you specified something different which compiling. Assuming you have compiled to an executable you need to make it executable as a program if it is not already:

The file is not executable, try running:

chmod +x s9p2
share|improve this answer

Your Answer


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.