background preloader

C/c++

Facebook Twitter

How to Debug Programs. How to Debug Programs 1. How to Start 1.1 Thinking about Programming 1.2 Structured Programming 2. Compiling Programs 2.1 Compiler Errors 2.2 Linker Errors 3. Runtime Errors 4. 5. This document explains how to write computer programs that work and that are understandable to other intelligent beings! Writing structured programs (structured code and data!)

Lots of well-defined functions! 1. The most common types of mistakes when programming are: Programming without thinking Writing code in an unstructured manner Let's take these in order 1.1 Thinking about Programming When a real programmer (or programming team) is given a problem to solve, they do not immediately sit down at a terminal and start typing in code! One of the biggest myths of programming is that: The sooner I start coding the sooner a working program will be produced. So how does one design a program before coding? Top-down design divides the program into sub-tasks. 1.2 Structured Programming 2. 2.1 Compiler Errors 2.2 Linker Errors. The Big Blob » Getting started with Google Test (GTest) on Ubuntu. Google test is a framework for writing C++ unit tests. In this short post, I explain how to set it up in Ubuntu. Start by installing the gtest development package: Note that this package only install source files. You have to compile the code yourself to create the necessary library files.

These source files should be located at /usr/src/gtest. Browse to this folder and use cmake to compile the library: Lets say we now want to test the following simple squareRoot function: In the following code, we create two tests that test the function using a simple assertion. The next step is to compile the code. Compile and run the tests: Have fun testing! References. C++ concat texte. Googlemap install and config. Code organization - How should I organize my source tree.

Opencv

Detecting hand gestures using Haarcascades training. Using OpenCV with Eclipse (plugin CDT) — OpenCV v2.4.3 documentation. Note Two ways, one by forming a project directly, and another by CMake Prerequisites Having installed Eclipse in your workstation (only the CDT plugin for C/C++ is needed). You can follow the following steps:Go to the Eclipse siteDownload Eclipse IDE for C/C++ Developers . Choose the link according to your workstation.Having installed OpenCV. If not yet, go here. Making a project Start Eclipse. If you check in your folder, there should be an executable there.

Running the executable So, now we have an executable ready to run. Cd <DisplayImage_directory> cd src . Assuming that the image to use as the argument would be located in <DisplayImage_directory>/images/HappyLittleFish.png. Go to Run->Run ConfigurationsUnder C/C++ Application you will see the name of your executable + Debug (if not, click over C/C++ Application a couple of times). Congratulations! V2: Using CMake+OpenCV with Eclipse (plugin CDT) Say you have or create a new file, helloworld.cpp in a directory called foo: Done!

Environment Variables - Using the GNU Compiler Collection. These environment variables control the way that GCC uses localization information which allows GCC to work with different national conventions. GCC inspects the locale categories LC_CTYPE and LC_MESSAGES if it has been configured to do so. These locale categories can be set to any value supported by your installation. A typical value is ‘en_GB.UTF-8’ for English in the United Kingdom encoded in UTF-8. The LC_CTYPE environment variable specifies character classification. GCC uses it to determine the character boundaries in a string; this is needed for some multibyte encodings that contain quote and escape characters that are otherwise interpreted as a string end or escape. The LC_MESSAGES environment variable specifies the language to use in diagnostic messages. If the LC_ALL environment variable is set, it overrides the value of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES default to the value of the LANG environment variable.

GCC and Make - A Tutorial on how to compile, link and build C/C++ applications. 1. GCC (GNU Compiler Collection) 1.1 A Brief History and Introduction to GCC The original GNU C Compiler (GCC) is developed by Richard Stallman, the founder of the GNU Project. Richard Stallman founded the GNU project in 1984 to create a complete Unix-like operating system as free software, to promote freedom and cooperation among computer users and programmers.

GCC, formerly for "GNU C Compiler", has grown over times to support many languages such as C++, Objective-C, Java, Fortran and Ada. It is now referred to as "GNU Compiler Collection". The mother site for GCC is GCC is a key component of "GNU Toolchain", for developing applications, as well as operating systems. GCC is portable and run in many operating platforms. The various GCC versions are: 1.2 Installing GCC GCC (GNU Toolchain) is included in all Unixes. MinGW GCC MinGW (Minimalist GNU for Windows) is a port of the GNU Compiler Collection (GCC) and GNU Binutils for use in Windows. Cygwin GCC Versions Help > a $ .