make files

Discussion in 'C++' started by newbai, Jan 5, 2007.

  1. newbai

    newbai Guest

    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
     
    newbai, Jan 5, 2007
    #1
    1. Advertising

  2. newbai

    Ondra Holub Guest

    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).
     
    Ondra Holub, Jan 5, 2007
    #2
    1. Advertising

  3. newbai

    Guest

    , Jan 5, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page