Jump to content

  • Log In with Google      Sign In   
  • Create Account


AlexB.hpp

Member Since 11 Oct 2012
Offline Last Active Aug 23 2013 03:35 AM
-----

Topics I've Started

[С++] Memory leak checker

27 November 2012 - 04:42 PM

I've started working on simple and little class for C++ to check some memory leaks. I have made some work on it, but there is a lot of work to do. I'm planing to add cppunit, autoreconf, documentation, static class instread of global functions, different loggers.

Now it has:
shared library,
header with some funcs declarations,
makefile to build it via g++,
simple script to test it,
linux only but I'll port it to win after some researching.

I do it for my own project but I would like to share it with a great pleasure.

Now it looks like this
alexb leak_checker> ./run.sh
MEMORY LEAK! 0x8c1a008 main.cpp 5
MEMORY LEAK! 0x8c1a038 main.cpp 6

with such main:
#include <iostream>
#include "allocation_hooks.h"
int main(int argc, char** argv) {
  int* num = new int;
  num = new int[1];
  check_map();
}


Repo is here.

PS Warning it has some magic in it! ^_^

30 Tips For Newbie Game Programmers

20 November 2012 - 02:08 PM

I've got nice link from 3D Game Engine Programming by Stefan Zerbst and Oliver Duvel to gamasutra.com.

Surfing it for a little I've got to a programmer blogs. And got it - 30 Tips For Newbie Game Programmers by Emrah Ozer.

I want to talk a little about 8th tip:

If you're developing your own game -please I beg you- don't make a clone game. Nobody needs a another bubble game. Clone game development causes you to not to learn the game design iteration process.


I think it's really important for us, I'm talking about novices in gamedev which are looking for idea to realize.
There is no need to realize ping-pong, asteroids, breakout and other crap, being implemented so many times...

For those who don't know about ludum dare.
So as a source of ideas I want to show you ludum dare contest. There is no prizes or anything, but there you can find really interesting in gamedev people which can give you a nice feedback to make you game better. So read about this contest and take a part in next one.

Lesson 35 linux. Mistake in makefile

11 October 2012 - 03:53 AM

Good day for you.

I've got an error in lesson 35 (Playing avi in OpenGL) on compilation.

alexb@alexb-GA-MA770-UD3:~/Projects/lesson35_linux$ make
g++ -g -O2 -Wall -I./ -I/usr/include -L./ -L/usr/lib/ -L/usr/lib/fglrx/ -lglut -lGL -lGLU -laviplay lesson35.cpp -o lesson35
lesson35.cpp: In function ‘int main(int, char**)’:
lesson35.cpp:116:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
/tmp/cc8tev0Q.o: In function `display_func()':
/home/alexb/Projects/lesson35_linux/lesson35.cpp:365: undefined reference to `glClear'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:382: undefined reference to `glLoadIdentity'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:383: undefined reference to `glTranslatef'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:391: undefined reference to `glRotatef'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:392: undefined reference to `glRotatef'
/home/alexb/Projects/lesson35_linux/lesson35.cpp:393: undefined reference to `glTranslatef'


An actually I've got the problem. It's in makefile.
all:
		$(CC) $(CC_OPT) $(INCLUDES) $(LIBS) lesson35.cpp -o lesson35
there is wrong order of options.
For g++ as CC you should use the next one:
all:
		$(CC) lesson35.cpp $(CC_OPT) $(INCLUDES) $(LIBS) -o lesson35

alexb@alexb-GA-MA770-UD3:~/Projects/lesson35_linux$ make
g++ lesson35.cpp -lglut -lGL -lGLU -laviplay -o lesson35
lesson35.cpp: In function ‘int main(int, char**)’:
lesson35.cpp:116:49: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
alexb@alexb-GA-MA770-UD3:~/Projects/lesson35_linux$


added

There is another mistake in lesson35.cpp. At line 71-72

StreamInfo *streaminfo = 0;	   // represents the avi streaminfo

g++ says that StreamInfo isn't a type.

To fix it you should replace:

#include <avifile/StreamInfo.h>
with
#include <avifile/infotypes.h>

because of StreamInfo doesn't work without AVIFILE_INFOTYPES_H in avifile-0.7.

Add namespace specifier here
avm::StreamInfo *streaminfo = 0;

Thanks to Jeff Molofee (NeHe), Fredster and Jonathan de Blok for the lesson.

PARTNERS