• Advertisement
Sign in to follow this  

[Solved] c++ undefined reference

This topic is 2569 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
// bitmap
Sprite* img;

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

// shoot function
void Shoot();

bool alive;


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;
int anims;

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

// 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);


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.

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
Sign in to follow this  

  • Advertisement