wiki:VincentTrial

Version 9 (modified by garonne, 19 years ago) (diff)

--

How do i begin playing with CMT ?

by V.Garonne (05.4.2005)

Aim of this document

The purpose of this little document is to understand and use CMT with simple examples.

How to install CMT ?

See:

How to create a package ?

We do here the classic "Hello World" example with CMT. First we create the cmt package called "test" with version 1:

> cmt create test v1
------------------------------------------
Configuring environment for package test version v1.
CMT version v1r18p20050501.
Root set to /users/dsksi/garonne.
System is Linux-i686
------------------------------------------
Installing the package directory
Installing the version directory
Installing the cmt directory
Installing the src directory
Creating setup scripts.
Creating cleanup scripts.
> cd test/v1
> ls 
cmt src

We see here that a directory tree has been created. We now create and writye our small "C++" program (main.cxx, hello.h and hello.cxx). We have:

> more src/hello.h
//////////////////////////////////////////////////
// author: vincent garonne                      //
// date:   4/5/2005                             //
// description: hello world description file    //
//////////////////////////////////////////////////

#ifndef __HELLO_WORLD__
#define __HELLO_WORLD__

class hello
{
    public:
        // constructor
        hello  () {}
        
        // desctructor
        ~hello (){}

        // function example
        void print ();
};
#endif // __HELLO_WORLD__
> more src/hello.cxx
//////////////////////////////////////////////////
// author: vincent garonne                      //
// date:   4/5/2005                             //
// description: hello world body                //
//////////////////////////////////////////////////

using namespace std;
#include <iostream>

#include "hello.h"

void hello::print ()
{
        cout<<"Hello le world !!!"<<endl;
}
> more src/main.cxx
//////////////////////////////////////////////////
// author: vincent garonne                      //
// date:   4/5/2005                             //
// description: main program                    //
//////////////////////////////////////////////////
#include "hello.h"

int main ()
{     
     hello object;
     object.print();
     return 0;
}