make files

N

newbai

I have a query.Hope someone can help me in this!!!
A c++ code consists of include statements,main(),function defination
..now I want to make separte files.I mean the first file will be of only
include statements.The secand of funciton defination and third of
main().but I dont know how to make them?how do you name them??
can someone explain me with a simple example?
please be fast!!!thanks
 
O

Ondra Holub

newbai napsal:
I have a query.Hope someone can help me in this!!!
A c++ code consists of include statements,main(),function defination
.now I want to make separte files.I mean the first file will be of only
include statements.The secand of funciton defination and third of
main().but I dont know how to make them?how do you name them??
can someone explain me with a simple example?
please be fast!!!thanks

You can name your files as you want. Usualy exist some project or
company naming conventions. For C sources are usually used files with
..c extension. For C++ sources is typically used one of .cpp, .cc, .C
extension. For header files is used .h extension, sometimes is used for
C++ headers .hpp or .hh or .H.

There is no standard requirement how to name file with main (as for
example in java). one of the typical way is to place main function in
file main.cpp. Sometimes is the main function placed in file with the
same name as project.

It is important to use correct upper/lower case letters in #include
files, beacuse in some operating systems are used such filesystems,
where file header.h is different from Header.h.

Syntax of Makefile depends on which make are you using. It is compiler
(or better make) specific. Gnu make is not 100% compatible with
Microsoft nmake and it is not compatible with borland make (and of
course vice versa).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top