Author Topic: sdl compiling  (Read 5463 times)

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
sdl compiling
« on: June 30, 2016, 11:50:32 am »
I set up sdl according to this tut ....http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php
 ... everything went ok .. no error messages ... It seems to build ok yet when i run it i get a message saying it hasn't been built yet and offers to build it via a modal window. i click ok but the window just 'stays' offering to build it again and again .. til i click no to get  away from it... then it runs and i get
"process returned 4256912 <0x40f490>
 whats happening ..?  all the setup procedures went ok ....

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #1 on: June 30, 2016, 12:05:58 pm »
during the build i actually get message ...
-------------- Build: Debug in sdltester (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).
....
don't know if this is an error ...

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #2 on: June 30, 2016, 12:18:07 pm »
AND ..... when I'm setting the linker libraries I copy and pasted
"-lmingw32 -lSDL2main -lSDL2 " from the tut into the "other linker options" panel ...
My sdl stuff is in C:\libraries\|Documents\MyDocuments\sdlunzipped\SDL-1.2.15...
is the provided code correct for me ?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: sdl compiling
« Reply #3 on: June 30, 2016, 02:43:49 pm »
please follow the steps described here: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

during the build i actually get message ...
-------------- Build: Debug in sdltester (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).
....
don't know if this is an error ...
this is not enougth information, you need to make a rebuild and post the log

greetings

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #4 on: June 30, 2016, 03:59:49 pm »
I am running Code::Blocks release 16.01 on windows7 home premium service pack 1
. The compiler I use is ming 1.2.15


When I ...
try to build and run an example cpp from the tut here
http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php

Description of problem.
the build, i suspect, failed .... ctrl+f9 gives ....

-------------- Build: Debug in sdltester (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).

a Rebuild gives .....

-------------- Clean: Debug in sdltester (compiler: GNU GCC Compiler)---------------

Cleaned "sdltester - Debug"

-------------- Build: Debug in sdltester (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).

I appreciate the formatting ...  thanks ...
I have no idea how to run from command line .. havn't tried it obviously

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #5 on: June 30, 2016, 04:15:43 pm »
....................full command line compile logging is selected

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: sdl compiling
« Reply #6 on: June 30, 2016, 04:53:35 pm »
This is really messed up ???

1) Please use code tags to post code/ logs (use the button with the  # symbol in the topic editor)
2) Do you really make a Build->Rebuild (or ctrl-F11) ?
3) Is this really the output of the "Build Log" tab and NOT from the "Build Messages" ?
4) Have you created a project?
5) Have you really followed the steps from the link you posted, or have you tried something more?

greetings

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #7 on: June 30, 2016, 05:48:19 pm »
ok ... i found a previous mail similar .. it seems i hadnt 'add' the test code properly ....
I have followed the tut meticulously ...
I have now managed a build which failed with coding probs ... rebuild gives..
-------------- Clean: Debug in sdlentry (compiler: GNU GCC Compiler)---------------

Cleaned "sdlentry - Debug"

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

mingw32-g++.exe -Wall -std=c++11 -g -std=c++11 -IC:\Users\Owner\Documents\sdlunzipped\SDL-1.2.15\include\SDL -c C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp -o obj\Debug\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.o
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp: In function 'int SDL_main(int, char**)':
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:15:2: error: 'SDL_Window' was not declared in this scope
  SDL_Window* window = NULL;
  ^
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:15:14: error: 'window' was not declared in this scope
  SDL_Window* window = NULL;
              ^
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:28:46: error: 'SDL_WINDOWPOS_UNDEFINED' was not declared in this scope
   window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
                                              ^
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:28:125: error: 'SDL_WINDOW_SHOWN' was not declared in this scope
   window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
                                                                                                                             ^
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:28:142: error: 'SDL_CreateWindow' was not declared in this scope
   window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
                                                                                                                                              ^
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:36:49: error: 'SDL_GetWindowSurface' was not declared in this scope
    screenSurface = SDL_GetWindowSurface( window );
                                                 ^
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:42:36: error: 'SDL_UpdateWindowSurface' was not declared in this scope
    SDL_UpdateWindowSurface( window );
                                    ^
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:50:28: error: 'SDL_DestroyWindow' was not declared in this scope
  SDL_DestroyWindow( window );
                            ^
Process terminated with status 1 (0 minute(s), 0 second(s))
8 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #8 on: June 30, 2016, 06:58:58 pm »
code in question

Code: [Select]
/
*This source code copyrighted by Lazy Foo' Productions (2004-2015)
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;
}

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: sdl compiling
« Reply #9 on: June 30, 2016, 10:47:01 pm »
1) Please use code tags also for logs...
2) http://stackoverflow.com/questions/12695719/sdl-window-does-not-name-a-type or use google future, you have now a sdl problem, not a code blocks problem and so this is the wrong forum to ask this questions

greetings

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #10 on: July 01, 2016, 03:44:20 pm »
ok ... fairly rigourous this site eh ?  .....
 even pedantic .... I get the feeling that no one remembers being a
 newbie...I am ok with c++ , I remember the tools and how to combine them but
 the  environment and it's links to libraries are practically unique and as such a newbie
 is faced with an array of settings that are mundane to a versed user..
Thaks for the link and your help... didn't see a rush to help me ... good on ya BlueHazzard..
no doubt we shall talk in future ..

do you like triphop ? ........

https://soundcloud.com/uncle-reg

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #11 on: July 02, 2016, 12:07:58 am »
It's not really an SDL problem though is it ? ... it's a problem linking a lib to code blocks ...
 kinda says that newbie problems with their setup IS handled on this very site ...
 says it in the induction post ..

Offline unclereg

  • Multiple posting newcomer
  • *
  • Posts: 20
Re: sdl compiling
« Reply #12 on: July 02, 2016, 12:17:18 am »
pretty sure the code i copied and pasted into the 'other linked libraries' right hand window was
 erroneous for me ... since all my sdl stuff is somewhere else ... mydocuments tbp
 hence the code ...
Code: [Select]
-lmingw32 -lSDL2main -lSDL2   . copied from tut
(i've never seen this '-object notation before)
 http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php
is wrong yeah ?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6675
    • My Best Post
Re: sdl compiling
« Reply #13 on: July 02, 2016, 01:07:24 am »
Please read the rules before you are banned!
http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: sdl compiling
« Reply #14 on: July 02, 2016, 02:03:19 am »
look i really want to help you. My english is not the best so i write in short pointy style to make my points clear...
It's not really an SDL problem though is it ? ... it's a problem linking a lib to code blocks ...

1) according this error:
Code: [Select]
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp: In function 'int SDL_main(int, char**)':
C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp:15:2: error: 'SDL_Window' was not declared in this scope
  SDL_Window* window = NULL;
you have a compiling not a linking problem

2) according this line:
Code: [Select]
mingw32-g++.exe -Wall -std=c++11 -g -std=c++11 -IC:\Users\Owner\Documents\sdlunzipped\SDL-1.2.15\include\SDL -c C:\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.cpp -o obj\Debug\Users\Owner\Documents\uz01_hello_SDL-5\01_hello_SDL\01_hello_SDL.oYou have corretly added the include paths so that the compiler can find the include files

according this code:
Code: [Select]
#include <SDL.h>you include some sdl header, but you get some errors, so i presume that your sdl installation is broken, or you mix sdl with sdl2... Both are not problems with codeblocks, but with sdl
i am not familiar with sdl so i googeled for two seconds and found this:
2) http://stackoverflow.com/questions/12695719/sdl-window-does-not-name-a-type or use google future, you have now a sdl problem, not a code blocks problem and so this is the wrong forum to ask this questions

and so Tim came to this conclusion
Please read the rules before you are banned!
http://forums.codeblocks.org/index.php/topic,9996.0.html

If you have found out, that you are using sdl2 headers, but want to use sdl1 headers, and you don't know where to set the right path so the compiler can find your sources, you can ask this here (but you can set include paths as there are set some in 2) ) ... but for other questions, like "error: 'SDL_Window' was not declared in this scope" we have to ask you to search help in a other forum. They will tell you: "you have to include xy" or "you have to add zq to your compiler search directories". Then you can come back and ask "how do i add zq to my compiler search directories?" and we will happily help you...

greetings
« Last Edit: July 02, 2016, 02:06:57 am by BlueHazzard »