Installing SDL2, getting "SDL_Texture does not name a type"

Have been racking my brain over the last week trying to get this to work. I am a noob so forgive any obvious things I missed.

First, I am using Ubuntu 12.04 LTS and couldn’t find any packages I could install, so I downloaded the source and compiled the SDL2 library. When I check, it looks like the headers have been installed in the /usr/local/include directory and the .so files were installed in /usr/local/lib.

I am using Code::Blocks and added the following to the Project Build options:

Search Directories --> Compiler: /usr/local/include
Search Directories --> Linker: /usr/local/lib
Search Directories --> Resource Compiler: /usr/local/include and /usr/local/lib
Linker Settings --> Other linker options: -SDL2main -lSDL2

In my source code I have the following include statement:

#include <SDL2/SDL.h>

I’m pretty sure I’m at least pointing to the right place because if I change it, it gives me a “No such file or directory” error instead.

When it comes time to compile, it hits the first line I declare an SDL_Texture object, raising an error that “SDL_Texture does not name a type”.

My understanding is that this error usually means that the referenced object is not defined elsewhere. I just migrated from using SDL 1.2 and switched all my SDL_Surfaces to SDL_Textures, but I thought that by including the SDL.h file, it included all the object definitions, so I’m at a loss.

Here is the excerpt from my header file raising the error: “SDL_Texture does not name a type”

#ifndef CSURFACE_H
#define CSURFACE_H

#include <SDL/SDL.h>

class CSurface {
public:
CSurface();
int X;
int Y;

public:
    //static SDL_Surface* OnLoad(char* File);
    static SDL_Texture* OnLoad(char* file);    <------------- Error is here

and here are the file listings where my compiled SDL2 files are.

/usr/local/include/SDL2:

SDL.h
SDL_assert.h
SDL_atomic.h
SDL_audio.h
SDL_bits.h
SDL_blendmode.h
SDL_clipboard.h
SDL_config.h
SDL_cpuinfo.h
SDL_endian.h
SDL_error.h
SDL_events.h
SDL_filesystem.h
SDL_gamecontroller.h
SDL_gesture.h
SDL_haptic.h
SDL_hints.h
SDL_joystick.h
SDL_keyboard.h
SDL_keycode.h
SDL_loadso.h
SDL_log.h
SDL_main.h
SDL_messagebox.h
SDL_mouse.h
SDL_mutex.h
SDL_name.h
SDL_opengl.h
SDL_opengles.h
SDL_opengles2.h
SDL_pixels.h
SDL_platform.h
SDL_power.h
SDL_quit.h
SDL_rect.h
SDL_render.h
SDL_revision.h
SDL_rwops.h
SDL_scancode.h
SDL_shape.h
SDL_stdinc.h
SDL_surface.h
SDL_system.h
SDL_syswm.h
SDL_test.h
SDL_test_assert.h
SDL_test_common.h
SDL_test_compare.h
SDL_test_crc32.h
SDL_test_font.h
SDL_test_fuzzer.h
SDL_test_harness.h
SDL_test_images.h
SDL_test_log.h
SDL_test_md5.h
SDL_test_random.h
SDL_thread.h
SDL_timer.h
SDL_touch.h
SDL_types.h
SDL_version.h
SDL_video.h
begin_code.h
close_code.h

/usr/local/lib:
libSDL2-2.0.so.0
libSDL2-2.0.so.0.2.1
libSDL2.a
libSDL2.la
libSDL2.so
libSDL2_test.a
libSDL2main.a
ocaml
pkgconfig
python2.7
site_ruby

Not sure if it didn’t compile correctly, not sure if I have to manually include all the related SDL headers (I didn’t have to do that on SDL 1.2), not sure if I’m missing something in my linker instructions.

Help!

What’s your include statement for SDL2? I think you forgot to include the filename.

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>On 2014/10/ 18, at 20:47, almightyj wrote:

Have been racking my brain over the last week trying to get this to work. I am a noob so forgive any obvious things I missed.

First, I am using Ubuntu 12.04 LTS and couldn’t find any packages I could install, so I downloaded the source and compiled the SDL2 library. When I check, it looks like the headers have been installed in the /usr/local/include directory and the .so files were installed in /usr/local/lib.

I am using Code::Blocks and added the following to the Project Build options:

Search Directories --> Compiler: /usr/local/include
Search Directories --> Linker: /usr/local/lib
Search Directories --> Resource Compiler: /usr/local/include and /usr/local/lib
Linker Settings --> Other linker options: -SDL2main -lSDL2

In my source code I have the following include statement:

#include

I’m pretty sure I’m at least pointing to the right place because if I change it, it gives me a “No such file or directory” error instead.

When it comes time to compile, it hits the first line I declare an SDL_Texture object, raising an error that “SDL_Texture does not name a type”.

My understanding is that this error usually means that the referenced object is not defined elsewhere. I just migrated from using SDL 1.2 and switched all my SDL_Surfaces to SDL_Textures, but I thought that by including the SDL.h file, it included all the object definitions, so I’m at a loss.

Here is the excerpt from my header file raising the error: “SDL_Texture does not name a type”

#ifndef CSURFACE_H
#define CSURFACE_H

#include

class CSurface {
public:
CSurface();
int X;
int Y;

public:
//static SDL_Surface* OnLoad(char* File);
static SDL_Texture* OnLoad(char* file); <------------- Error is here

and here are the file listings where my compiled SDL2 files are.

/usr/local/include/SDL2:

SDL.h
SDL_assert.h
SDL_atomic.h
SDL_audio.h
SDL_bits.h
SDL_blendmode.h
SDL_clipboard.h
SDL_config.h
SDL_cpuinfo.h
SDL_endian.h
SDL_error.h
SDL_events.h
SDL_filesystem.h
SDL_gamecontroller.h
SDL_gesture.h
SDL_haptic.h
SDL_hints.h
SDL_joystick.h
SDL_keyboard.h
SDL_keycode.h
SDL_loadso.h
SDL_log.h
SDL_main.h
SDL_messagebox.h
SDL_mouse.h
SDL_mutex.h
SDL_name.h
SDL_opengl.h
SDL_opengles.h
SDL_opengles2.h
SDL_pixels.h
SDL_platform.h
SDL_power.h
SDL_quit.h
SDL_rect.h
SDL_render.h
SDL_revision.h
SDL_rwops.h
SDL_scancode.h
SDL_shape.h
SDL_stdinc.h
SDL_surface.h
SDL_system.h
SDL_syswm.h
SDL_test.h
SDL_test_assert.h
SDL_test_common.h
SDL_test_compare.h
SDL_test_crc32.h
SDL_test_font.h
SDL_test_fuzzer.h
SDL_test_harness.h
SDL_test_images.h
SDL_test_log.h
SDL_test_md5.h
SDL_test_random.h
SDL_thread.h
SDL_timer.h
SDL_touch.h
SDL_types.h
SDL_version.h
SDL_video.h
begin_code.h
close_code.h

/usr/local/lib:
libSDL2-2.0.so.0
libSDL2-2.0.so.0.2.1
libSDL2.a
libSDL2.la
libSDL2.so
libSDL2_test.a
libSDL2main.a
ocaml
pkgconfig
python2.7
site_ruby

Not sure if it didn’t compile correctly, not sure if I have to manually include all the related SDL headers (I didn’t have to do that on SDL 1.2), not sure if I’m missing something in my linker instructions.

Help!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

In your header file (CSurface.h) you are including the SDL 1.2 header
rather than the SDL2 one.

Also, the Resource Compiler search directory is probably not what you want.
It’s used for putting icons
into Windows executables, for instance. You should instead add
include/library directories although I’m not
sure how this works in Code::Blocks. Passing that straight to the compiler
can be done with -I or -L (capital
eye and ell), respectively. In this case, it would be “-I/usr/local/include
-L/usr/local/lib”.–
Melker Narikka

On Sun, Oct 19, 2014 at 4:47 AM, almightyj wrote:

Have been racking my brain over the last week trying to get this to
work. I am a noob so forgive any obvious things I missed.

First, I am using Ubuntu 12.04 LTS and couldn’t find any packages I could
install, so I downloaded the source and compiled the SDL2 library. When I
check, it looks like the headers have been installed in the
/usr/local/include directory and the .so files were installed in
/usr/local/lib.

I am using Code::Blocks and added the following to the Project Build
options:

Search Directories --> Compiler: /usr/local/include
Search Directories --> Linker: /usr/local/lib
Search Directories --> Resource Compiler: /usr/local/include and
/usr/local/lib
Linker Settings --> Other linker options: -SDL2main -lSDL2

In my source code I have the following include statement:

#include

I’m pretty sure I’m at least pointing to the right place because if I
change it, it gives me a “No such file or directory” error instead.

When it comes time to compile, it hits the first line I declare an
SDL_Texture object, raising an error that “SDL_Texture does not name a
type”.

My understanding is that this error usually means that the referenced
object is not defined elsewhere. I just migrated from using SDL 1.2 and
switched all my SDL_Surfaces to SDL_Textures, but I thought that by
including the SDL.h file, it included all the object definitions, so I’m at
a loss.

Here is the excerpt from my header file raising the error: “SDL_Texture
does not name a type”

#ifndef CSURFACE_H
#define CSURFACE_H

#include

class CSurface {
public:
CSurface();
int X;
int Y;

public:
//static SDL_Surface* OnLoad(char* File);
static SDL_Texture* OnLoad(char* file); <------------- Error is here

and here are the file listings where my compiled SDL2 files are.

/usr/local/include/SDL2:

SDL.h
SDL_assert.h
SDL_atomic.h
SDL_audio.h
SDL_bits.h
SDL_blendmode.h
SDL_clipboard.h
SDL_config.h
SDL_cpuinfo.h
SDL_endian.h
SDL_error.h
SDL_events.h
SDL_filesystem.h
SDL_gamecontroller.h
SDL_gesture.h
SDL_haptic.h
SDL_hints.h
SDL_joystick.h
SDL_keyboard.h
SDL_keycode.h
SDL_loadso.h
SDL_log.h
SDL_main.h
SDL_messagebox.h
SDL_mouse.h
SDL_mutex.h
SDL_name.h
SDL_opengl.h
SDL_opengles.h
SDL_opengles2.h
SDL_pixels.h
SDL_platform.h
SDL_power.h
SDL_quit.h
SDL_rect.h
SDL_render.h
SDL_revision.h
SDL_rwops.h
SDL_scancode.h
SDL_shape.h
SDL_stdinc.h
SDL_surface.h
SDL_system.h
SDL_syswm.h
SDL_test.h
SDL_test_assert.h
SDL_test_common.h
SDL_test_compare.h
SDL_test_crc32.h
SDL_test_font.h
SDL_test_fuzzer.h
SDL_test_harness.h
SDL_test_images.h
SDL_test_log.h
SDL_test_md5.h
SDL_test_random.h
SDL_thread.h
SDL_timer.h
SDL_touch.h
SDL_types.h
SDL_version.h
SDL_video.h
begin_code.h
close_code.h

/usr/local/lib:
libSDL2-2.0.so.0
libSDL2-2.0.so.0.2.1
libSDL2.a
libSDL2.la
libSDL2.so
libSDL2_test.a
libSDL2main.a
ocaml
pkgconfig
python2.7
site_ruby

Not sure if it didn’t compile correctly, not sure if I have to manually
include all the related SDL headers (I didn’t have to do that on SDL 1.2),
not sure if I’m missing something in my linker instructions.

Help!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The HTML version of the message has unescaped angular brackets, and your
client is understandably not showing them.
The plaintext version seems fine.–
Melker Narikka

On Mon, Oct 20, 2014 at 7:35 AM, Jeffrey Carpenter wrote:

What’s your include statement for SDL2? I think you forgot to include the
filename.

Cheers,
Jeffrey Carpenter

On 2014/10/ 18, at 20:47, almightyj wrote:

Have been racking my brain over the last week trying to get this to
work. I am a noob so forgive any obvious things I missed.

First, I am using Ubuntu 12.04 LTS and couldn’t find any packages I
could install, so I downloaded the source and compiled the SDL2 library.
When I check, it looks like the headers have been installed in the
/usr/local/include directory and the .so files were installed in
/usr/local/lib.

I am using Code::Blocks and added the following to the Project Build
options:

Search Directories --> Compiler: /usr/local/include
Search Directories --> Linker: /usr/local/lib
Search Directories --> Resource Compiler: /usr/local/include and
/usr/local/lib
Linker Settings --> Other linker options: -SDL2main -lSDL2

In my source code I have the following include statement:

#include

I’m pretty sure I’m at least pointing to the right place because if I
change it, it gives me a “No such file or directory” error instead.

When it comes time to compile, it hits the first line I declare an
SDL_Texture object, raising an error that “SDL_Texture does not name a
type”.

My understanding is that this error usually means that the referenced
object is not defined elsewhere. I just migrated from using SDL 1.2 and
switched all my SDL_Surfaces to SDL_Textures, but I thought that by
including the SDL.h file, it included all the object definitions, so I’m at
a loss.

Here is the excerpt from my header file raising the error: “SDL_Texture
does not name a type”

#ifndef CSURFACE_H
#define CSURFACE_H

#include

class CSurface {
public:
CSurface();
int X;
int Y;

public:
//static SDL_Surface* OnLoad(char* File);
static SDL_Texture* OnLoad(char* file); <------------- Error is here

and here are the file listings where my compiled SDL2 files are.

/usr/local/include/SDL2:

SDL.h
SDL_assert.h
SDL_atomic.h
SDL_audio.h
SDL_bits.h
SDL_blendmode.h
SDL_clipboard.h
SDL_config.h
SDL_cpuinfo.h
SDL_endian.h
SDL_error.h
SDL_events.h
SDL_filesystem.h
SDL_gamecontroller.h
SDL_gesture.h
SDL_haptic.h
SDL_hints.h
SDL_joystick.h
SDL_keyboard.h
SDL_keycode.h
SDL_loadso.h
SDL_log.h
SDL_main.h
SDL_messagebox.h
SDL_mouse.h
SDL_mutex.h
SDL_name.h
SDL_opengl.h
SDL_opengles.h
SDL_opengles2.h
SDL_pixels.h
SDL_platform.h
SDL_power.h
SDL_quit.h
SDL_rect.h
SDL_render.h
SDL_revision.h
SDL_rwops.h
SDL_scancode.h
SDL_shape.h
SDL_stdinc.h
SDL_surface.h
SDL_system.h
SDL_syswm.h
SDL_test.h
SDL_test_assert.h
SDL_test_common.h
SDL_test_compare.h
SDL_test_crc32.h
SDL_test_font.h
SDL_test_fuzzer.h
SDL_test_harness.h
SDL_test_images.h
SDL_test_log.h
SDL_test_md5.h
SDL_test_random.h
SDL_thread.h
SDL_timer.h
SDL_touch.h
SDL_types.h
SDL_version.h
SDL_video.h
begin_code.h
close_code.h

/usr/local/lib:
libSDL2-2.0.so.0
libSDL2-2.0.so.0.2.1
libSDL2.a
libSDL2.la
libSDL2.so
libSDL2_test.a
libSDL2main.a
ocaml
pkgconfig
python2.7
site_ruby

Not sure if it didn’t compile correctly, not sure if I have to manually
include all the related SDL headers (I didn’t have to do that on SDL 1.2),
not sure if I’m missing something in my linker instructions.

Help!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I have successfully built SDL 2.0.3 deb packages for Ubuntu 12.04 for 64-bit architecture (amd64). If you use 64-bit Ubuntu, I can put here this packages. Additionally I built SDL2-Image packages. All packages tested on my own system. But I have not packages for i386 arch if you use 32-bit system.