Eldaronics
Posts: 3
Joined: Fri Sep 14, 2018 8:22 pm

gcc error: main.c No such file or directory

Sat Sep 15, 2018 6:49 am

I`m trying to create GUI programs with c and gcc as an editor.I precisely followed this tutorial:
https://prognotes.net/2015/…/gtk-3-c-pr ... g-glade-3/
Everything went well till i paste this command to the terminal:
gcc -o gladewin main.c -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic
It just gets an error: gcc error: main.c : No such file directory
I`m using Raspbian on Rpi2 and main.c,main_window.glade are in the same folder.Any ideas will be much appreciated.Thanks beforehand ;)

User avatar
joan
Posts: 13578
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: gcc error: main.c No such file or directory

Sat Sep 15, 2018 8:02 am

Could you repeat the command and also do a ls -l before hand? Cut & paste the terminal input and output so we can double check the commands being given.

Eldaronics
Posts: 3
Joined: Fri Sep 14, 2018 8:22 pm

Re: gcc error: main.c No such file or directory

Sat Sep 15, 2018 10:11 am

joan wrote:
Sat Sep 15, 2018 8:02 am
Could you repeat the command and also do a ls -l before hand? Cut & paste the terminal input and output so we can double check the commands being given.
Ok, you meant something like this?
[email protected]:~ $ ls -l
total 3204
-rw-r--r-- 1 pi pi 390258 Aug 30 00:05 2018-08-30-000503_1680x1050_scrot.png
-rw-r--r-- 1 pi pi 286530 Sep 11 06:17 2018-09-11-061743_1680x1050_scrot.png
-rw-r--r-- 1 pi pi 1078374 Sep 11 10:52 2018-09-11-105246_1680x1050_scrot.png
-rw-r--r-- 1 pi pi 1135962 Sep 11 10:53 2018-09-11-105249_1680x1050_scrot.png
-rw-r--r-- 1 pi pi 108539 Sep 13 05:30 2018-09-13-053005_1680x1050_scrot.png
-rw-r--r-- 1 pi pi 108539 Sep 13 05:30 2018-09-13-053006_1680x1050_scrot.png
-rw-r--r-- 1 pi pi 94718 Sep 14 12:04 2018-09-14-120403_1680x1050_scrot.png
drwxr-xr-x 3 pi pi 4096 Aug 19 00:11 Arduino
-rw-r--r-- 1 pi pi 2387 Aug 18 23:58 bar_graph-2018-08-18-23-58-34.py
drwxr-xr-x 6 pi pi 4096 Sep 14 13:11 Desktop
drwxr-xr-x 2 pi pi 4096 Jun 26 18:22 Documents
drwxr-xr-x 3 pi pi 4096 Aug 19 00:06 Downloads
-rw-r--r-- 1 pi pi 412 Aug 18 23:57 humidity-2018-08-18-23-57-01.py
-rw-r--r-- 1 pi pi 901 Aug 19 00:00 joystick_events-2018-08-19-00-00-15.py
drwxr-xr-x 2 pi pi 4096 Jun 26 18:00 MagPi
drwxr-xr-x 2 pi pi 4096 Jun 26 18:22 Music
drwxr-xr-x 3 pi pi 4096 Aug 29 13:24 oldconffiles
drwxr-xr-x 2 pi pi 4096 Jun 26 18:22 Pictures
drwxr-xr-x 2 pi pi 4096 Jun 26 18:22 Public
drwxr-xr-x 2 pi pi 4096 Jun 26 17:59 python_games
drwxr-xr-x 2 pi pi 4096 Jun 26 18:22 Templates
drwxr-xr-x 2 pi pi 4096 Jun 26 18:22 Videos
[email protected]:~ $ sudo gcc -o gladewin main.c -Wall `pkg-config --cflags --libs gtk+-3.0` -export-dynamic
gcc: error: main.c: No such file or directory

But, it`s still the same :(

User avatar
PeterO
Posts: 4257
Joined: Sun Jul 22, 2012 4:14 pm

Re: gcc error: main.c No such file or directory

Sat Sep 15, 2018 10:20 am

gcc is telling you there is no file called main.c in the current working directory.

In which subdirectory have you put the main.c file ?

Oh and why do you think you need to use sudo ?

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Eldaronics
Posts: 3
Joined: Fri Sep 14, 2018 8:22 pm

Re: gcc error: main.c No such file or directory

Sat Sep 15, 2018 8:25 pm

Thanks to everyone,problem is solved.
I just had to go to directory with cd /Desktop/GUI command where have main.c and main_window.glade files.

Return to “Graphics programming”