Jump to content
  • Advertisement
Sign in to follow this  

Major problem, please help

This topic is 4849 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

Anyone know how to fix this error?? cc1plus: error: unrecognized command line option "-fsave-memoized" The cc1plus.exe file is located inside my dev-cpp folder, but if move it, the program wont compile. So I don't know what to do. Heres my source:
// player = (SPRITE*)malloc(sizeof(SPRITE));
// the (SPRITE*) is major important

// ../../../../../../Dev-Cpp/lib/mappyal.o -lalleg

#include <stdio.h>
#include <allegro.h>
#include "mappyal.h"

#define WIDTH 640
#define HEIGHT 480
#define JUMPIT 1600

//define the sprite structure
typedef struct SPRITE
    int dir, alive;
    int x,y;
    int width,height;
    int xspeed,yspeed;
    int xdelay,ydelay;
    int xcount,ycount;
    int curframe,maxframe,animdir;
    int framecount,framedelay;

//declare the bitmaps and sprites
BITMAP *player_image[8];
SPRITE *player;
BITMAP *buffer;	
BITMAP *temp;

//tile grabber
BITMAP *grabframe(BITMAP *source, 
                  int width, int height, 
                  int startx, int starty, 
                  int columns, int frame)
    BITMAP *temp = create_bitmap(width,height);
    int x = startx + (frame % columns) * width;
    int y = starty + (frame / columns) * height;
    return temp;

int collided(int x, int y)
    BLKSTR *blockdata;
	blockdata = MapGetBlock(x/mapblockwidth, y/mapblockheight);
	return blockdata->tl;

int main (void)
    int mapxoff, mapyoff;
    int oldpy, oldpx;
    int facing = 0;
    int jump = JUMPIT;
    int n;

	// new stuff

	set_gfx_mode(MODE, WIDTH, HEIGHT, 0, 0);

    temp = load_bitmap("guy.bmp", NULL);
    for (n=0; n<8; n++)
        player_image[n] = grabframe(temp,50,64,0,0,8,n);

    player = (SPRITE*)malloc(sizeof(SPRITE));
    player->x = 80;
    player->y = 100;

    //load the map
	if (MapLoad("sample.fmp")) exit(0);	

    //create the double buffer
	buffer = create_bitmap (WIDTH, HEIGHT);
	// nes stuff
	// Load the custom mouse pointer
    BITMAP *reticle = load_bitmap("reticle.bmp", NULL);

    //main loop
	while (!key[KEY_ESC])

		oldpy = player->y; 
        oldpx = player->x;

		if (key[KEY_RIGHT]) 
            facing = 1; 
            if (++player->framecount > player->framedelay)
                if (++player->curframe > player->maxframe)
        else if (key[KEY_LEFT]) 
            facing = 0; 
            if (++player->framecount > player->framedelay)
                if (++player->curframe > player->maxframe)
        else player->curframe=0;

        //handle jumping
        if (jump==JUMPIT)
            if (!collided(player->x + player->width/2, 
                player->y + player->height + 5))
                jump = 0; 

		    if (key[KEY_SPACE]) 
                jump = 30;
            player->y -= jump/3; 

		if (jump<0) 
            if (collided(player->x + player->width/2, 
                player->y + player->height))
                jump = JUMPIT; 
                while (collided(player->x + player->width/2, 
                    player->y + player->height))
                    player->y -= 2; 

        //check for collided with foreground tiles
		if (!facing) 
            if (collided(player->x, player->y + player->height)) 
                player->x = oldpx; 
            if (collided(player->x + player->width, 
                player->y + player->height)) 
                player->x = oldpx; 
        //update the map scroll position
		mapxoff = player->x + player->width/2 - WIDTH/2 + 10;
		mapyoff = player->y + player->height/2 - HEIGHT/2 + 10;

        //avoid moving beyond the map edge
		if (mapxoff < 0) mapxoff = 0;
		if (mapxoff > (mapwidth * mapblockwidth - WIDTH))
            mapxoff = mapwidth * mapblockwidth - WIDTH;
		if (mapyoff < 0) 
            mapyoff = 0;
		if (mapyoff > (mapheight * mapblockheight - HEIGHT)) 
            mapyoff = mapheight * mapblockheight - HEIGHT;

        //draw the background tiles
		MapDrawBG(buffer, mapxoff, mapyoff, 0, 0, WIDTH-1, HEIGHT-1);

        //draw foreground tiles
		MapDrawFG(buffer, mapxoff, mapyoff, 0, 0, WIDTH-1, HEIGHT-1, 0);

        //draw the player's sprite
		if (facing) 
            draw_sprite(buffer, player_image[player->curframe], 
                (player->x-mapxoff), (player->y-mapyoff+1));
            draw_sprite_h_flip(buffer, player_image[player->curframe], 
                (player->x-mapxoff), (player->y-mapyoff));

        //blit the double buffer 
		blit(buffer, screen, 0, 0, 0, 0, WIDTH-1, HEIGHT-1);

	} //while

    for (n=0; n<8; n++)
	MapFreeMem ();
	// new stuff
	return 0;


Share this post

Link to post
Share on other sites
-fsave-memoized is a compiler flag which is apparently unrecognized. I don't recognize it either. You need to remove the flag itself.

How are you building the source? Makefile?

Share this post

Link to post
Share on other sites
For reference:


These flags are used to get the compiler to compile programs faster using heuristics. They are not on by default since they are only effective about half the time. The other half of the time programs compile more slowly (and take more memory).
The first time the compiler must build a call to a member function (or reference to a data member), it must (1) determine whether the class implements member functions of that name; (2) resolve which member function to call (which involves figuring out what sorts of type conversions need to be made); and (3) check the visibility of the member function to the caller. All of this adds up to slower compilation. Normally, the second time a call is made to that member function (or reference to that data member), it must go through the same lengthy process again. This means that code like this
cout << "This " << p << " has " << n << " legs.n";
makes six passes through all three steps. By using a software cache, a ``hit'' significantly reduces this cost. Unfortunately, using the cache introduces another layer of mechanisms which must be implemented, and so incurs its own overhead. `-fmemoize-lookups' enables the software cache.
Because access privileges (visibility) to members and member functions may differ from one function context to the next, g++ may need to flush the cache. With the `-fmemoize-lookups' flag, the cache is flushed after every function that is compiled. The `-fsave-memoized' flag enables the same software cache, but when the compiler determines that the context of the last function compiled would yield the same access privileges of the next function to compile, it preserves the cache. This is most helpful when defining many member functions for the same class: with the exception of member functions which are friends of other classes, each member function has exactly the same access privileges as every other, and the cache need not be flushed.

I second MaulingMonkey's suggestion to simply remove it.

Share this post

Link to post
Share on other sites
Uh...How would i go about removing it, I'm not even for sure where it's located. All I really know is that it hass something to do with gcc & the Dev-C++ update I did recently.

Share this post

Link to post
Share on other sites
Why don't you just create a new project and add your files to it?

Mike C.

Share this post

Link to post
Share on other sites
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!