-SDL- started getting an error for something i always use

I have always used just one file to build everything, ive had all sorts of issues with the linker in project so i have been opening empty files and just using global settings, now i decided to use more files its gotten complicatred with the linking very quickley, i would love to do all this in 'project' but for some reason i can link all the libraries in global options just not in project options!!

so any way heres the error for this code.

C:\Users\user\Documents\basic project\main.cpp|13|error: expected constructor, destructor, or type conversion before '.' token|
.......
||=== Build finished: 13 errors, 0 warnings ===|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
include <iostream>
#include <string>
#include <sdl/sdl_image.h>
#include <loadimage.h>
#include <SDL/SDL.h>
#include <applyimage.h>

SDL_Surface *screen = NULL;
SDL_Surface *blocks = NULL;

SDL_Rect clip [4];

clip[0].x = 0;  //error here but for all clips
clip[0].y = 0;
clip[0].h = 50;
clip[0].w = 50

clip[1].x = 50;
clip[1].y = 50;
clip[1].h = 50;
clip[1].w = 50

clip[2].x = 100;
clip[2].y = 100;
clip[2].h = 50;
clip[2].w = 50

clip[3].x = 100;
clip[3].y = 200;
clip[3].h = 50;
clip[3].w = 50
int main ( int argc, char** argv )

{
    SDL_Init(SDL_INIT_EVERYTHING);


    screen = SDL_SetVideoMode (640,480,32,SDL_SWSURFACE);
    blocks = SDL_LoadBMP ("cd.bmp");
    apply_surface (10,10,blocks,screen, &clip[0]);
    apply_surface (10,10,blocks,screen, &clip[1]);
    apply_surface (10,10,blocks,screen, &clip[2]);
    apply_surface (10,10,blocks,screen, &clip[3]);


    SDL_Flip (screen);
    SDL_Delay (2000);
    return 0;
}



EDIT: hey i just put the clips in the wrong place :P

but could you advise on the crazy linker buisness, its sooo confusing
Last edited on
I don't know but maybe each project use their own linker settings so you will have to add SDL to be linked to all your projects that use SDL.
can you tell me what this error means? im unable to create projects in SDL.and i was gonna make an awsome game project today :( .



-------------- Build: Debug in my SDL project ---------------

Linking console executable: bin\Debug\my SDL project.exe
mingw32-g++.exe: SDL: No such file or directory
mingw32-g++.exe: project -LC:\Users\user\Documents\my: Invalid argument
mingw32-g++.exe: SDL: No such file or directory
mingw32-g++.exe: project": Invalid argument
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

I think you need to put quotes around the path
-L"C:\Users\user\Documents\my SDL project.exe"

If this is nothing you can change you could try using a project name/directory name without spaces.
i got an ever so slightly different error message, what could you de-duce from this?

-------------- Build: Debug in my SDL project ---------------

Linking console executable: bin\Debug\my SDL project.exe
mingw32-g++.exe: SDL: No such file or directory
mingw32-g++.exe: project.exe: No such file or directory
mingw32-g++.exe: Files\CodeBlocks\MinGW\lib -LC:\Users\user\Documents\C++: Invalid argument
mingw32-g++.exe: folder -LC:\boost\boost_1_47_0\boost_1_47_0 -LC:\boost\boost_1_47_0\boost_1_47_0\boost\asio -LC:\Users\user\Documents\basic: Invalid argument
mingw32-g++.exe: project -o bin\Debug\my: No such file or directory
mingw32-g++.exe: SDL: No such file or directory
mingw32-g++.exe: project.exe obj\Debug\main.o -lmingw32 -lSDLmain -lSDL -lSDL_image -lmingw32 -lSDLmain -lSDL -lSDL_image C:\Program: Invalid argument
mingw32-g++.exe: Files\CodeBlocks\MinGW\lib\SDL_image.lib C:\Users\user\Downloads\SDL-1.2.15\lib\libSDLmain.a C:\Program: Invalid argument
mingw32-g++.exe: Files\CodeBlocks\MinGW\lib\SDL_image.lib C:\Users\user\Downloads\SDL-1.2.15\lib\libSDLmain.a C:\Program: Invalid argument
mingw32-g++.exe: Files\CodeBlocks\MinGW\lib\SDL_image.lib: No such file or directory
mingw32-g++.exe: no input files

should i just use a different editor? linkers are annoying
Last edited on
is there a tutorial thats very concise and specific when it comes to setting up a sdl project on code blocks
yeah thas who i been learning from, i have managed to start a new project and get that working it may have been spaces in the project name, it may have been some settings when i included something iwill proly need your help when i add a new header and it soesnt work, i find livraries and apis to be overly complex to install, i hope linux is as much easier as they say it is
Linking console executable: bin\Debug\my SDL project.exe
mingw32-g++.exe: SDL: No such file or directory
mingw32-g++.exe: project.exe: No such file or directory


It would appear you have spaces in the project name.. and your toolchain doesn't like it. (In other words, the same problem as in your previous post.)
Last edited on
ahh solved; i put off using headers for a bit too long, now i will build myself a library :D

i will be able to make more stuff faster, im starting to feel progress.
Topic archived. No new replies allowed.