LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


So this is my first linux code.

[
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");
else
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, 02:23 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
usually you complie c programs with gcc. something like
Code:
#to compile:
gcc /whatever/floats/your/boat.c -o /whatever/grinds/your/gears.x
#and then you just run it like a normal program:
/whatever/grinds/your/gears.x
make sure you have gcc installed. on debian it is probably something like
Code:
apt-get install gcc
 
Old 09-22-2015, 04:15 PM   #3
whoovian11
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?
 
  


Reply



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 10:40 PM
compile C in Ubuntu 8.04 lipun4u Ubuntu 4 10-24-2008 10:59 AM
how do i compile in ubuntu python? phantom_cyph Programming 10 02-16-2007 10:28 PM
Cant compile on Ubuntu 5.10 Breezy mdkusr Linux - Software 1 12-07-2005 07:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:54 PM.

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