sashkosnail / test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This package contains several programs for beginners.
It includes sources and creates binaries.

Programs available here are:

fileOperations_cpp
A program demonstrating how to operate with files.
Performs reading and writing operations.

basic_class ... a simple program which demonstrates how to create a simple class in C++.

=== How to add a new C++ file to the project ===

This is a guide to adding a new C++ file using autotools, by editing the
files in the project directory.

Let's say that we have added a file named my_test.cpp to the project
directory and we want to build a binary my_test from that file.
Let's also say that my_test.cpp includes the <pcre.h> header and uses the
function pcre_compile.

The steps for compilation and making binaries below assume your current
working directory is the project directory. When running from a different
directory append -p <path_to_your_project> to the commands.

1) Update the file Makefile.am to add the new binary name at the end of
   bin_PROGRAMS like:

     bin_PROGRAMS = <existing_binaries> my_test

2) Tell autotools to build the my_test.cpp file, by adding a new line to
   Makefile.am:

     my_test_SOURCES = my_test.cpp

3) To add a test to the configure script to check whether the header is
   on the target system call devassistant with these parameters:

     da modify c header --header pcre.h

4) To add a test for the library call devassistant with these parameters:

     da modify c lib -l libpcre -f pcre_compile>

   The project makefile will be updated so the binary will be linked
   with the library.

5) When the project is buildable and no errors occurs then you can add
   your binary to the RPM, by modifying the <project_name>.spec file
   stored in your project directory.

   In that file add your binary in the %install section as a new line like:

     install -p -m 755 -D my_test ${RPM_BUILD_ROOT}%{_bindir}/my_test

   You also need to add that file in %files section with a new line like:

     %{_bindir}/my_test

   Update the %changelog section to record the change.

6) To build the RPM package leave your project directory and run the
   command:

     da create c cpp -n <your_project_name> -b 

About


Languages

Language:C++ 100.0%