LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-09-2004, 02:17 AM   #1
adoyee
LQ Newbie
 
Registered: Jul 2003
Posts: 16

Rep: Reputation: 0
head,lib


I write my own head.h file:

#include <stdio.h>
....

then write a function:

/*filename: fuc.c */
int fun(){
printf ("Hello,world\n");
}
saved in directory lib/fuc.c

in main.c:
/*main.c*/
int main(){
fuc();
return 0;
}

they look like this :
main.c
lib/fun.c
include/head.h

and now,how to compile these files correctly?
 
Old 02-09-2004, 08:10 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
First of all you have to do '#include "include/head.h"' in both of your C files.

Then you do: gcc <source files> -o <executable name>

Example: gcc main.c fun.c -o fun
 
  


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
"Locking in" Glibc (replace prob /lib/ld-linux.so.2 with /tools/lib/ld-linux.so.2 irfanali Linux From Scratch 11 06-29-2006 10:19 AM
Multi-monitor Issues on RH9, Geforce 4 Ti Dual Head + TNT2 Single Head the letter b Linux - Newbie 3 12-04-2004 11:23 PM
Compromised? Files "/usr/lib.hwm", "/usr/lib.pwd", "/usr/lib.pwi" Klaus Pforte Linux - Security 4 09-28-2004 11:33 PM
iiimf-client-lib & iiimf-protocol-lib cooldownguy86 Linux - Software 1 06-29-2004 06:25 AM
x86 Solaris 9 XSun and Matrox G550 dual-head... one head down, one to go. finegan Solaris / OpenSolaris 4 03-11-2003 12:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:22 AM.

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