Mail Archives: djgpp/1999/06/03/12:57:05
From: | "Ilari Kaartinen" <ililka AT mantta DOT fi>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Question from a C/C++ newbie
|
Date: | Wed, 2 Jun 1999 14:36:20 -0000
|
Organization: | TPO Internet
|
Message-ID: | <7j350v$j5n$1@news.koti.tpo.fi>
|
References: | <7j2c1a$tu5$1 AT ins8 DOT netins DOT net>
|
NNTP-Posting-Host: | s.kurvi.phpoint.net
|
X-Newsreader: | Microsoft Outlook Express 4.72.3110.5
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3
|
Lines: | 62
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
You can make one like this...
// file1.c
int return_a_number(int i,int i2)
{
return i+i2;
}
// end
// header.h
#ifndef __HEADER_H__
#define __HEADER_H__
int return_a_number(int,int);
#endif
// end
// mainfile.c
#include "header.h"
// C++
// #include <iostream>
int main (void)
{
// print or count, whatever...
// C++
// cout << "1 + 2 = " << return_a_number(1,2) << endl;
// C
// printf("1 + 2 = %d\n",return_a_number(1,2));
return 0;
}
// end
then compile (if you are not using rhide)
gcc mainfile.c file1.c -o output.exe
or if you want to optimate:
gcc mainfile.c file1.c -o output.exe -O3 -ffast-math
(in that program it would rather not so useful to optimate, but...=)
- Ilari
Clint Knapp kirjoitti viestissä <7j2c1a$tu5$1 AT ins8 DOT netins DOT net>...
>Ok,
>I've got a simple question, but like I said I'm new to this. How do I use
>Make files? are they like the Visual Basic vbp files, are they what get
>opened for a project? Are they what you use to compile a large project with
>more than one .c or .cpp file?
>
>I know these questions sound really lame, but I've had no experience with
>C/C++ compiling at all, I've done very basic things with C/C++, I would
just
>like to know some things. If there's much else I need to know please tell
>me.
>
>Clint Knapp
>
>
- Raw text -