Jump to content
  • Advertisement
Sign in to follow this  
Devil0150

[Solved] c++ undefined reference

This topic is 2756 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody. I have a problem with my program. I get the following errors when I compile my code:

undefined reference to '__w32_sharedptr_terminate'
undefined reference to '__w32_sharedptr_unexpected'
undefined reference to '__w32_sharedptr_terminate'
undefined reference to '__w32_sharedptr_unexpected'
undefined reference to '__w32_sharedptr_unexpected'
undefined reference to '__w32_sharedptr_terminate'

I'm using Code::Blocks and allegro library. By commenting some lines, I think I found out where the problem is in my code.


Plane::Plane(char* path, int animations)
{
img = new Sprite(path, 0, 0, animations); // if this line is commented, it compiles fine, without errors.
alive = true;
}


The Plane class:

// file: "Plane.h"
#ifndef PLANE_H
#define PLANE_H

#include "Sprite.h"

class Plane
{
public:
// bitmap
Sprite* img;

// constructor and destructor
Plane(char* path, int animations = 0);
~Plane();

// shoot function
void Shoot();

bool alive;
};

#endif


The Sprite class:

#ifndef SPRITE_H
#define SPRITE_H

#include "allegro.h"
#include "time.h"
#include <string>

class Sprite
{
// bitmap
BITMAP* spr;

// animation data
int anim_counter;
public:
int anims;

// constructor and destructor
Sprite(char* path, int X, int Y, int animations = 0);
~Sprite();

// timing data
clock_t anim_start;
clock_t move_start;

// bitmap data
int x, y, w, h;

// rendering and animation
void Erase(BITMAP* dest, BITMAP* bg);
void Draw(BITMAP* dest, BITMAP* bg);
void Animate(int anim_per_sec, BITMAP* anim_spr[]);

// displacement
void relative_move(int x_offset, int y_offset);
void timed_move(int x_offset, int y_offset, int ops);
void Move(int x_val, int y_val);

// bitmap modding
void add_rgb(int red, int green, int blue, BITMAP* sprite = 0);
void add_rgb_region(int red, int green, int blue, int x1, int, int x2, int y2);
void stretch(int coefficient);
};

#endif


I seached a little on Google and I found stuff about not linking libraries correctly. None of them was about allegro so I didn't know what to do.

EDIT:
I solved it. The files these warnings came from were "libstdc++.a" and "libsupc++.a". I removed them from the list of libraries to link (Settings-->Compiler and debugger-->Linker Settings) and I got no errors.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!