Jump to content

  • Log In with Google      Sign In   
  • Create Account


fireshadow4126

Member Since 21 Jul 2009
Offline Last Active Jun 30 2012 03:02 PM

Topics I've Started

Segmentation Fault When Calling Draw Function

29 June 2012 - 07:05 AM

Hello,

I'm working on my game framework. It compiles fine, but when I run the executable (which is eventually going to be a working game), I get this message from gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b73152 in Survive::Game::TwoD::Entity2D::draw (this=0x91a, display=0x640f20) at libsurvive/src/game/2d/Entity2D.cpp:26
26		  spr.draw(display, x, y);

This is the definition of Entity2D::draw:

void Entity2D::draw(SDL_Surface *display) {
	 spr.draw(display, x, y);
}

display is a pointer to the screen, I know it is valid.
spr is the entity's underlying sprite. I know it has been constructed correctly, because the entity initialized fine.
x and y are the coordinates to draw the sprite at. They have both been instantiated.

What might be causing this then?

I'm working in Ubuntu, using makefiles generated by premake to build.

Thanks in advance!

Symbol Lookup Error When Executing Main

21 June 2012 - 10:34 AM

Hello,

I posted this same question in Game Programming, but only after I posted it did I realize this is a more appropriate place to ask.

Anyway, I'm working on my game framework in C++. It is composed of a shared library containing all the features and an executable used to test the features (The executable will eventually become a working game).

The library and executable both compile and link fine, but when I try to execute it, I get this error:

main/bin/debug/main: symbol lookup error: main/bin/debug/main: undefined symbol: _ZN7Survive8Graphics4TwoD6SpriteC1Ev

Survive::Graphics::TwoD::Sprite is a sprite class for 2D images.

I'm wondering, what would cause this error?

Sprite and Graphics2D, a class used to draw to a given Sprite, are both defined in Sprite.hpp and implemented in their respective .cpp files. Could this be a cause of the problem?

Otherwise, what would cause this?

Thanks in advance!

Symbol Lookup Error When Executing Main

20 June 2012 - 10:51 AM

Hello,

I'm working on my game framework in C++. It is composed of a shared library containing all the features and an executable used to test the features (The executable will eventually become a working game).

The library and executable both compile and link fine, but when I try to execute it, I get this error:

main/bin/debug/main: symbol lookup error: main/bin/debug/main: undefined symbol: _ZN7Survive8Graphics4TwoD6SpriteC1Ev

Survive::Graphics::TwoD::Sprite is a sprite class for 2D images.

I'm wondering, what would cause this error?

Sprite and Graphics2D, a class used to draw to a given Sprite, are both defined in Sprite.hpp and implemented in their respective .cpp files. Could this be a cause of the problem?

Otherwise, what would cause this?

Thanks in advance!

Undefined Reference to Array members

28 May 2012 - 09:54 AM

Hello,

I'm programming a game engine in C++, mostly for educational purposes. I have a custom generic array class (mostly so that I can add better handling of dynamic allocation later) and everything compiles fine, but when I try to link I get this:

libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector3>::~Array()'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector2>::~Array()'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector3>::Array()'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector3>::resize(unsigned long)'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector3>::size() const'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector2>::Array()'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector2>::resize(unsigned long)'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector3>::operator[](unsigned long)'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector3>::clear()'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector2>::clear()'
libsurvive/bin/debug/libsurvive.so: undefined reference to `Survive::System::Array<Survive::Math::Vector2>::size() const'

what is interesting about this is that the only errors seem to be with constructors/destructors and with functions that use 'size_t.' Anyway, here's the definition of the array class:
#include <stddef.h>


namespace Survive {
	 namespace System {
          template<typename Type>
		  class Array {
			   public:
					Array();
					Array(size_t size);
					~Array();

					void add(Type item);

					void clear();

					size_t size() const;

					Type &operator[](size_t i);
					void resize(size_t newSize);

				private:
					 Type *pointer;
					size_t capacity;
					size_t numElements;
		  };
	 }
}

I'm using g++ and makefiles generated by premake.

Anyone have any idea on how to fix this problem?

Thanks in advance!

Automake/Autoconf Examples?

24 May 2012 - 04:15 PM

Hello,

I'm working on my C++ game engine from Ubuntu by using the old text-editor/console approach. So far, I've simply been creating the makefiles myself, but as there get to be more subdirectories in the source folder, I've realized I need something more efficient.

The solution to this seems to be to use the GNU Build System, ie, autoconf, automake, etc. The example that comes with automake, amhello, seems too simple for me, but I find that the manuals go too in depth for my purposes.

Could someone point me to a simple tutorial or example on how to write good automake/autoconf files?

Thanks in advance!

PARTNERS