User forums > Using Code::Blocks

Project not building after change in its properties

<< < (2/3) > >>

AndrewCot:
Looks like you are mixing 32 and 64 bit code and libraries.

The tutorial includes the following paragraph that explains which SDL directory contains the 32 bit library and which contains the 64 bit library:

Open the gzip archive and there should be a tar archive. Open up the tar archive and the should be a folder called SDL2-2.something.something. In side of that folder there should be a bunch of folders and files, most importantly i686-w64-mingw32 which contains the 32bit library and x86_64-w64-mingw32 which contains the 64bit library.

You need to use the same 32bit or 64 bit library to match the 32bit or 64 bit Mingw you installed. If you installed the 32bit MINGW you need to use the 32bit SDL2 library or if you installed the 64 bit MINGW then you need to use the 64bit SDL2 library.

Miguel Gimenez:
Or use the -m32 or -m64 flag when compiling...

stahta01:

--- Quote from: Miguel Gimenez on September 20, 2021, 09:31:34 am ---Or use the -m32 or -m64 flag when compiling...

--- End quote ---

There is not a great chance on Windows of having a GCC MinGW compiler that really works well with the -m32 or -m64 flags.
This is because the builders do not tend to make the C++ libraries for both 32 and 64 bit use.
I have no idea if they make the C libraries for both 32 and 64 bit use.

Tim S.

pion:
Hello again, thanks for the advice. I followed this tutorial: https://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php and tried both, the 32 bit version and the 64 bit version, I also tried the compiler flags. Unfortunately, it still doesnt work.
The rebuild log looks better now, but it still shows a sort of error:


--- Code: ----------------- Clean: Debug in SDL2Testproject (compiler: GNU GCC Compiler)---------------

Cleaned "SDL2Testproject - Debug"

-------------- Build: Debug in SDL2Testproject (compiler: GNU GCC Compiler)---------------

Linking stage skipped (build target has no object files to link)
Nothing to be done (all items are up-to-date).


--- End code ---

This time I used this code (from https://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php):


--- Code: ---/*This source code copyrighted by Lazy Foo' Productions (2004-2020)
and may not be redistributed without written permission.*/

//Using SDL and standard IO
#include <SDL.h>
#include <stdio.h>

//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

int main( int argc, char* args[] )
{
//The window we'll be rendering to
SDL_Window* window = NULL;

//The surface contained by the window
SDL_Surface* screenSurface = NULL;

//Initialize SDL
if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
{
printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
}
else
{
//Create window
window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
if( window == NULL )
{
printf( "Window could not be created! SDL_Error: %s\n", SDL_GetError() );
}
else
{
//Get window surface
screenSurface = SDL_GetWindowSurface( window );

//Fill the surface white
SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) );

//Update the surface
SDL_UpdateWindowSurface( window );

//Wait two seconds
SDL_Delay( 2000 );
}
}

//Destroy window
SDL_DestroyWindow( window );

//Quit SDL subsystems
SDL_Quit();

return 0;
}


--- End code ---

Could it have something to do with the Path variable? Or with the inclusion of the header file? I've seen people mention that on other posts.

Miguel Gimenez:
You have created a new project, did you add the new source file to it?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version