Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-22-2015, 03:03 PM   #1
LQ Newbie
Registered: Sep 2015
Posts: 5

Rep: Reputation: Disabled
How to compile something in Ubuntu?

So this is my first linux code.

#include <stdio.h>
#include <time.h>
#include <sys/stat.h>
void printaccess(char *path) {
struct stat statbuf;
if (stat(path, &statbuf) == -1)
perror("Failed to get file status");
printf("%s last accessed at %s", path, ctime(&statbuf.st_atime));
How do I compile this to check if this is correct?
Old 09-22-2015, 03:23 PM   #2
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,267

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
usually you complie c programs with gcc. something like
#to compile:
gcc /whatever/floats/your/boat.c -o /whatever/grinds/your/gears.x
#and then you just run it like a normal program:
make sure you have gcc installed. on debian it is probably something like
apt-get install gcc
Old 09-22-2015, 05:15 PM   #3
LQ Newbie
Registered: Sep 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
what does whatever floats you boar and whatever grinds your gears mean?
Is the filenames??
Also how to compile if C++?
Could you please check if my coding is correct? I am trying to print out the time the path was created?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Ubuntu 10.04: compile audacity 1.2.6 gustav521 Linux - Software 2 04-13-2011 11:40 PM
compile C in Ubuntu 8.04 lipun4u Ubuntu 4 10-24-2008 11:59 AM
how do i compile in ubuntu python? phantom_cyph Programming 10 02-16-2007 11:28 PM
Cant compile on Ubuntu 5.10 Breezy mdkusr Linux - Software 1 12-07-2005 08:56 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:18 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration