Help! Porting issue with SDL

Started by
6 comments, last by mvBarracuda 14 years, 10 months ago
Hello all. :) I have a little demo for a game that I wrote in SDL & C++. On Linux (Newest edition of Ubuntu) it compiles and runs fine. However, when I compile it under a virtual Win2000 computer, it always aborts in the build process. I am using Code::Blocks to compile it on Win2000. The error occurs in the gameloops.cpp file according to teh build log. This is the 'error' I got:

Compiling: gameloops.cpp
Process terminated with status 1 (0 minutes, 4 seconds)
0 errors, 7 warnings
The whole building log has this:

Compiling: constants.cpp
Compiling: cursor.cpp
Compiling: fire.cpp
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp: In member function `void fireParticle::logic()':
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp:36: warning: converting to `int' from `double'
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp:37: warning: converting to `int' from `double'
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp:39: warning: converting to `int' from `double'
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp: In member function `void fireParticleHandler::logic()':
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp:74: warning: comparison between signed and unsigned integer expressions
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp: In member function `void fireParticleHandler::render()':
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp:98: warning: comparison between signed and unsigned integer expressions
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp: In member function `void fireHandler::logic()':
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp:123: warning: comparison between signed and unsigned integer expressions
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp: In member function `void fireHandler::render()':
C:\Documents and Settings\Jonas\Desktop\dod\fire.cpp:133: warning: comparison between signed and unsigned integer expressions
Compiling: gameloops.cpp
Process terminated with status 1 (0 minutes, 4 seconds)
0 errors, 7 warnings


There would be about 10 more files for compilation after gameloops.cpp - but they hever get compiled since it is aborting on gameloops.cpp. The contents of the file are the following: [gameloops.cpp]

#include "gameloops.h"

cursor cursor1;
sandParticleHandler sandParticleHandler1;
scanLineHandler *scanLineHandler1 = new scanLineHandler(4);
fireHandler fireHandler1;

void startGame() {
    for (int t = 0; t < 1000; t++) {
        sandParticleHandler1.createParticles(rand()%500+200, rand()%500, 2);
    }
}

void gameEvents() {
    while (SDL_PollEvent(&SDLEvent) != 0) {
        if (SDLEvent.type == SDL_QUIT) {
            gameRunning = false;
        }
        if (SDLEvent.type == SDL_MOUSEMOTION) {
            cursor1.events();
            XMouse = SDLEvent.motion.x;
            YMouse = SDLEvent.motion.y;
            if (SDLEvent.motion.xrel < -20 || SDLEvent.motion.xrel > 20) {
                WINDSPEEDX += SDLEvent.motion.xrel;
                WINDSPEEDX /= 50;
            }
            if (SDLEvent.motion.yrel < -20 || SDLEvent.motion.yrel > 20) {
                WINDSPEEDY += SDLEvent.motion.yrel;
                WINDSPEEDY /= 50;
            }
        }
        if (SDLEvent.type == SDL_MOUSEBUTTONDOWN) {
            mousePressed = true;
        }
        if (SDLEvent.type == SDL_MOUSEBUTTONUP) {
            mousePressed = false;
        }
        if (SDLEvent.type == SDL_KEYDOWN) {
            switch (SDLEvent.key.keysym.sym) {
                case SDLK_SPACE: spacePressed = true; break;
                default: break;
            }
        }
        if (SDLEvent.type == SDL_KEYUP) {
            switch (SDLEvent.key.keysym.sym) {
                case SDLK_SPACE: spacePressed = false; break;
                default: break;
            }
        }
    }
}

void gameLogic() {
    //Update the physics...
    wind();

    //Update cursor
    cursor1.logic();
    if (mousePressed == true) {
        sandParticleHandler1.createParticles(XMouse, YMouse, rand()%40);
    }
    sandParticleHandler1.logic();
    if (spacePressed == true) {
        fireHandler1.createFire(XMouse, YMouse, 500);
    }
    fireHandler1.logic();
}

void gameRender() {
    //Fill the screen with black
    SDL_FillRect(screen, NULL, 0);
    //Background
    JAPI_applySurface(0, 0, backgroundSurface, screen, NULL);
    //Update sand particles
    sandParticleHandler1.renderParticles();
    fireHandler1.render();
    //Render the border
    JAPI_applySurface(0, 0, screenBorderSurface, screen, NULL);
    //Render GUI
    JAPI_applySurface(0, 0, gameBarSurface, screen, NULL);
    //Render the cursor
    cursor1.render();
    //Render Scanlines
    scanLineHandler1->render();
    //JAPI_applySurface(0, 0, scanlineSurface, screen, NULL);
    SDL_Flip(screen);
}


What really surprises me is that I do not use any SDL threads or anything like that. OS in theory it should work under any operating system that supports SDL. Even more surprising is that I do not get ANY error message during compilation... Hope someone here can get to the root to the problem-I already tried making it another Code::Blocks project. In the past I have successfully ported 2 [small] games to Win2000 using Code::Blocks on windows... Thanks for your time.
Advertisement
Your error messages feature "fire.cpp" and the line numbers. You posted "gameloops.cpp", which happens to be the last file compiled. It does not appear to be the source of any errors according to that build log.

Finally "HEEELLPP!!" is a terrible thread title. You should include some actual information relevant to what you want help in. For example: SDL C++ program fails to build in code::blocks.

Having a bad thread title can cause your post to be overlooked.
^They are only warnings, no actual errors.

Edit: Sorry about the thread title, I got a bit worked up over it... ;)
Fixed the title.
Quote:Original post by pseudobot
^They are only warnings, no actual errors.


I don't use code::blocks, but it is possible that it has an option like "treat warnings as errors" on by default.
I do not think this feature exists inside Code::Blocks. I checked around the build options, and didn't find it.
What versions of code blocks and mingw are you running?
Code::Blocks: 8.02
MingW: 3.14
You could try with a more recent mingw version, maybe the issue vanishes then? You can find the latest mingw snapshots at: http://tdragon.net/recentgcc/
-----PARPG - open source isometric 2d old school RPG still looking for interested contributors

This topic is closed to new replies.

Advertisement