MinGW Freeglut 64bit on Windows Example

MinGW is a port of GCC to Windows, many people use Visual Studio C++ IDE on Windows, but it's ... . Then we need to download glut, in this example I will use freeglut, the old glut is not maintained ... anymore. You can find a freeglut package for Windows at http://www.transmissionzero.co.uk/software ... /freeglut-devel/. It contains the GL header files and lib, dll files, both for 32bit and 64bit, use

First MinGW C++ program on Windows

MinGW is a port of GCC to Windows, many people use Visual Studio C++ IDE on Windows, but it's ... . Here is an example C++ program, it's very simple #include <iostream> #include <list> using ... you want. Download a MinGW distribution and unpack it to local, you can find a distribution here ... and type g++ --version, you are good to go. E:\sync\MinGW>g++ --version g++ (GCC) 7.2.0

How to use memcpy example

The memcpy function is declared in stdlib.h. It accepts three arguments: the destination ... position. Here is the example code: #include <stdlib.h> #include <stdio.h> #include ... ** argv) { int buf[1024]; buf[1] = 0xffffffff; char * s = "bazzar"; //memcpy ... (buf, s, strlen(s)); memcpy(buf, s, strlen(s) + 1); printf("buf is %s", buf); printf("\n

How to use data breakpoint in Visual Studio

Data breakpoint is a breakpoint that be triggered when the content of a specified memory location is modified.

In a complex program, to find where and when a specific variable was modified may be difficult.

Log text to file with log4cpp

First step is download source code from github.

If you are using Visual Studio 10, after update the solution file, modify log4cppLIB.vcxproj like this.

Some const examples in C++

The const modifier is always a confusing keyword. Here are some of them.

They are equivalent, the const modifies the left element, if the const has no left element, means the const is the first key word, then it modifies the right element.

How to use assignment operator

The assignment operator and copy constructor often confuse people. Here is an example.

If you create new object from old object like this.

How to use inline in C++

If you define your member function inside class declaration , they are implicitly inline.

The inline function is supposed to improve the performance by embedding the function body to calling place and so reduce calling cost. It has two disadvantages: add the size of the program and change of the inline function will make caller recompile.

C++ enum example and tutorial

enum(enumeration) is a user-defined type consisting of a set of enumerators( enumerator --- named integer constant)

Simple enum definition:

An Introduction of the C++ Standard Template Library

The C++ STL(Standard Template Library) is a carefully constructed library developed by Alexander Stepanov, Meng Lee and others at Hwelett Packard.

The core of STL include container which represent data structure and algorithm which apply on the data structure and iterator which is the bridge between container and algorightm.

1 2 Next Page