Saturday, 21 October 2017

Quick basic guide for compiling in C

* Basic simplest way to compile a c++ file

$ g++  file.cpp
This will generate an executable 'a.out' which we can execute to run the program
$ ./a.out
output of the program here.


* If we desire to have a specific name for the generated file we can do:
$ g++ file.cpp -o specificname.o
$ ./specificname.o

* Make
By running the command make, we can organize the compilation in a single file named Makefile. Makefiles are a simple way to organize code compilation.

Run make in the location where your Makefile is to compile and link everything.
If you want verbose output, you can type VERBOSE=1 make (helpful if something goes wrong).
--> A guide for doing Makefiles: http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/

* CMake
CMake is another way to compile the code specially if you need to link several libraries and the project start getting more complex. You just need to have a CMakeLists.txt file.

First, create a build folder and go inside the folder.
Inside your build directory, point cmake to the directory containing the  CMakeLists.txt file. 
$ cmake ..the .. will point to the parent location where your code is.

If all goes well, cmake will process your CMakeLists.txt files, find the location of all libraries and include paths and spew a bunch of configuration information including a traditional Makefile in your build directory.
From here, you can use the traditional make stated in the previous item.
Run make in your build directory

--> A guide for cmake can be found here: https://www.cs.swarthmore.edu/~adanner/tips/cmake.php

** ccmake 
ccmake is an interface for cmake. Project configuration can be specified interactively through this GUI.

--> A guide for ccmake https://cmake.org/cmake/help/v3.0/manual/ccmake.1.html


CMakeLists.txt: You can create a file called 'CMakelists.txt'.





Useful resources

Friday, 9 June 2017

Dynamic libraries in Linux

See this nice post and solution to common problems.

https://codeyarns.com/2014/01/14/how-to-add-library-directory-to-ldconfig-cache/

Thursday, 20 April 2017

Command output to a file in several ways!



Command output to a file in several ways!

The link bellow contains an excellent table to show all the possibilities to do that: 
https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file

Friday, 31 March 2017

Saturday, 28 January 2017

Cmake versus Make


https://prateekvjoshi.com/2014/02/01/cmake-vs-make/

Info of your hardware



Gui of your hardware in ubuntu:
lshw-gtk

Information about your display hardware in command line
sudo lshw -C display
 
Info of CPU
cat /proc/cpuinfo 

Tuesday, 3 January 2017

Add and external package (such as google chrome) to be updated with the system from external official repository


Follow the steps of the most visible answer in this website.  Authors add the official latest stable version of google chrome to be updated in conjunction with the system.

http://askubuntu.com/questions/510056/how-to-install-google-chrome