-
Make Files
hi-
I've just found myself thrust into compiling some c modules and I have to use make files options. I have a bit of a learning curve in front of me.
could someone please direct me to a few good sites describing make files, particularly in gcc? Tutorial sites?
thx
-
Code:
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
char str[10];
//Creates an instance of ofstream, and opens example.txt
ofstream a_file ( "example.txt" );
// Outputs to example.txt through a_file
a_file<<"This text will now be inside of example.txt";
// Close the file stream explicitly
a_file.close();
//Opens for reading the file
ifstream b_file ( "example.txt" );
//Reads one string from the file
b_file>> str;
//Should output 'this'
cout<< str <<"\n";
// b_file is closed implicitly here
}
from www.cprogramming.com
-
MystWind: I don't think that is what shipyard meant. Also, this is the C board not C++
I've never written a makefile before but here is what google returned
http://oucsace.cs.ohiou.edu/~bhumphre/makefile.html
-
-
quite the same prob....
urmmm...
i've just manage to run my MakeFile....I now i'm working on the DEbUG mode.... i use the Borland compiler though...slightly different files n command but maybe u can apply it to whatever u're trying to work out :)
-
I'm not a makefile expert, but this is at least a simple example of one:
Code:
INCL = header.h
SRC = file1.c file2.c file3.c
OBJ = $(SRC:.c=.o)
LIBS = -lcomctl32
EXE = a.exe
# compiler stuff
CC = gcc
CFLAGS = -O3
LDFLAGS = -o $(EXE) $(LIBS)
CFDEBUG = -g -DDEBUG $(LDFLAGS)
RM = rm -f
# create object files
%.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o
# linker objects
$(EXE): $(OBJ)
$(CC) $(OBJ) menu.o $(LDFLAGS) -mwindows
# object-dependent libraries
$(OBJ): $(INCL)
# make debug
debug:
$(CC) $(CFDEBUG) $(SRC)
# make clean
clean:
$(RM) $(OBJ) $(EXE)
-
thanks for the links and examples.