Posts Tagged ‘c’

Eclipse – Exclude / de-exclude from build

Thursday, June 25, 2009 22:02 6 Comments

Sometimes working with Eclipse can be frustrating. I just spent an hour of my life looking how to include back a file into build that was excluded before (exclude from build). To spare you that drama, just go to: Project Preferences -> C/C++ General -> Paths & Symbols ->  Source Location Click on the folder [...]

This was posted under category: IDE Tags: , , , , , , , ,

C++ static keyword

Tuesday, June 23, 2009 1:10 No Comments

The static keyword can be used in the following situations. When you declare a variable or function at file scope (global and/or namespace scope), the static keyword specifies that the variable or function has internal linkage. When you declare a variable, the variable has static duration and the compiler initializes it to 0 unless you [...]

This was posted under category: C++, Programming Tags: , , , ,

C++ Generate random numbers in Range

Monday, June 8, 2009 17:06 No Comments

To make use of the rand() command you must include the cstdlib library #include <cstdlib> Before we generate a random number we call the srand(int) function to seed the randomizer so we dont get the same random number each time. #include <ctime> srand(time(NULL)); // time(NULL) returns seconds since 1.1.1970 To get the random number in [...]

This was posted under category: C++, Programming Tags: , , , , , , , , ,

Eclipse square bracket [] problem

Saturday, June 6, 2009 18:04 No Comments

Some people will experience a problem with Eclipse when trying to close the square brackets []. Eclipse will complain about not beeing able to evaluate a text selection and it won’t allow you typing that closing bracket. I got frustrated a bit because of not knowing whats going on. It wasn’t possible to write simple [...]

This was posted under category: C++, IDE, Programming Tags: , , , , , ,