Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » CDT and SDL howto ??
CDT and SDL howto ?? [message #127108] Sat, 13 November 2004 20:25 Go to next message
Eclipse UserFriend
Originally posted by: efthym.gmx.net

Hi all,

I just installed Eclipse with CDT and i'm trying to compile some program=
s =

that include the SDL library with no luck. Tried including =

/usr/include/SDL and the sdl-config --cflags and sdl-config --libs. =

Searching on eclipse.org (or anywhere else) didn't reveal anything.
Am i missing something ? What should I check for ?
Anybody that has had success with this PLEASE HELP !

I'm using eclipse 3.0.1 with cdt 2.0.2.

Thanx in advance
Re: CDT and SDL howto ?? [message #127278 is a reply to message #127108] Tue, 16 November 2004 14:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dschaefe.ca.ibm.com

I wish I could bring you luck, but you didn't describe what went wrong and
you didn't describe where you entered your SDL stuff.

Doug.

"Efthym" <efthym@gmx.net> wrote in message
news:opshfkwig8x4rl5m@localhost...
Hi all,

I just installed Eclipse with CDT and i'm trying to compile some programs
that include the SDL library with no luck. Tried including
/usr/include/SDL and the sdl-config --cflags and sdl-config --libs.
Searching on eclipse.org (or anywhere else) didn't reveal anything.
Am i missing something ? What should I check for ?
Anybody that has had success with this PLEASE HELP !

I'm using eclipse 3.0.1 with cdt 2.0.2.

Thanx in advance
Re: CDT and SDL howto ?? [message #127338 is a reply to message #127278] Tue, 16 November 2004 17:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: efthym.gmx.net

Hi Doug,

I tried the Managed Make project but couldn't get anywhere with that.
In the Unmanaged Make Project, i put the includes under =

Project->Properties->Include Paths->Add external include. There I put =

"/usr/include/SDL". After that, the path is shown in the C/C++ Project =

View .
In the makefile I have "SDL_CFLAGS :=3D $(shell sdl-config --cflags)" an=
d
"SDL_LDFLAGS :=3D $(shell sdl-config --libs)"

There is only one main.cpp file in my project which "include <SDL.h>".
When I try to compile, I keep getting a "SDL.h: No such file or =

directory". All the rest of the errors I think are caused because of thi=
s).

I hope this helps.
Thanx

Efthym


On Tue, 16 Nov 2004 14:03:31 -0500, Doug Schaefer <dschaefe@ca.ibm.com> =
=

wrote:

> I wish I could bring you luck, but you didn't describe what went wrong=
=

> and
> you didn't describe where you entered your SDL stuff.
>
> Doug.
>
> "Efthym" <efthym@gmx.net> wrote in message
> news:opshfkwig8x4rl5m@localhost...
> Hi all,
>
> I just installed Eclipse with CDT and i'm trying to compile some progr=
ams
> that include the SDL library with no luck. Tried including
> /usr/include/SDL and the sdl-config --cflags and sdl-config --libs.
> Searching on eclipse.org (or anywhere else) didn't reveal anything.
> Am i missing something ? What should I check for ?
> Anybody that has had success with this PLEASE HELP !
>
> I'm using eclipse 3.0.1 with cdt 2.0.2.
>
> Thanx in advance
>
>
Re: CDT and SDL howto ?? [message #127488 is a reply to message #127338] Wed, 17 November 2004 10:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.ideaworks3d.com

Try using

#include <SDL/SDL.h>

which means you shouldnt need to add the external include path in the project properties (assuming the /usr/include is
in your default include path)

good luck

martin


Efthym wrote:
> Hi Doug,
>
> I tried the Managed Make project but couldn't get anywhere with that.
> In the Unmanaged Make Project, i put the includes under
> Project->Properties->Include Paths->Add external include. There I put
> "/usr/include/SDL". After that, the path is shown in the C/C++ Project
> View .
> In the makefile I have "SDL_CFLAGS := $(shell sdl-config --cflags)" and
> "SDL_LDFLAGS := $(shell sdl-config --libs)"
>
> There is only one main.cpp file in my project which "include <SDL.h>".
> When I try to compile, I keep getting a "SDL.h: No such file or
> directory". All the rest of the errors I think are caused because of this).
>
> I hope this helps.
> Thanx
>
> Efthym
>
Re: CDT and SDL howto ?? [message #127500 is a reply to message #127488] Wed, 17 November 2004 11:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: martin.ideaworks3d.com

thinking about it, this seems to imply that the option of adding an external include path doesnt have any effect for
an unmanaged build. (I tried using the same setup as you and got the same results)

I havent tried this using a managed build, which I think would work using the external paths because the managed build
manager would just write this into the makefile.

so i think it all makes sense.

martin

Martin Wood wrote:
> Try using
>
> #include <SDL/SDL.h>
>
> which means you shouldnt need to add the external include path in the
> project properties (assuming the /usr/include is in your default include
> path)
>
> good luck
>
> martin
>
>
> Efthym wrote:
>
>> Hi Doug,
>>
>> I tried the Managed Make project but couldn't get anywhere with that.
>> In the Unmanaged Make Project, i put the includes under
>> Project->Properties->Include Paths->Add external include. There I put
>> "/usr/include/SDL". After that, the path is shown in the C/C++
>> Project View .
>> In the makefile I have "SDL_CFLAGS := $(shell sdl-config --cflags)" and
>> "SDL_LDFLAGS := $(shell sdl-config --libs)"
>>
>> There is only one main.cpp file in my project which "include <SDL.h>".
>> When I try to compile, I keep getting a "SDL.h: No such file or
>> directory". All the rest of the errors I think are caused because of
>> this).
>>
>> I hope this helps.
>> Thanx
>>
>> Efthym
>>
Re: CDT and SDL howto ?? [message #127563 is a reply to message #127500] Wed, 17 November 2004 13:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dschaefe.ca.ibm.com

"Martin Wood" <martin@ideaworks3d.com> wrote in message
news:cnftoj$249$1@www.eclipse.org...
> thinking about it, this seems to imply that the option of adding an
external include path doesnt have any effect for
> an unmanaged build. (I tried using the same setup as you and got the same
results)

You are correct, as far as the build goes. The Include Paths in the
properties of standard make are used by CDT's internal parser for all our
parser based features such as search, content assist, etc.

>
> I havent tried this using a managed build, which I think would work using
the external paths because the managed build
> manager would just write this into the makefile.

I have successfully used managed make with SDL. Simply put the output of
sdl-config in the right spots in the managed make properties. This stuff
should be pretty static anyway.

Cheers,
Doug

>
> so i think it all makes sense.
>
> martin
>
> Martin Wood wrote:
> > Try using
> >
> > #include <SDL/SDL.h>
> >
> > which means you shouldnt need to add the external include path in the
> > project properties (assuming the /usr/include is in your default include
> > path)
> >
> > good luck
> >
> > martin
> >
> >
> > Efthym wrote:
> >
> >> Hi Doug,
> >>
> >> I tried the Managed Make project but couldn't get anywhere with that.
> >> In the Unmanaged Make Project, i put the includes under
> >> Project->Properties->Include Paths->Add external include. There I put
> >> "/usr/include/SDL". After that, the path is shown in the C/C++
> >> Project View .
> >> In the makefile I have "SDL_CFLAGS := $(shell sdl-config --cflags)" and
> >> "SDL_LDFLAGS := $(shell sdl-config --libs)"
> >>
> >> There is only one main.cpp file in my project which "include <SDL.h>".
> >> When I try to compile, I keep getting a "SDL.h: No such file or
> >> directory". All the rest of the errors I think are caused because of
> >> this).
> >>
> >> I hope this helps.
> >> Thanx
> >>
> >> Efthym
> >>
Re: CDT and SDL howto ?? [message #127576 is a reply to message #127563] Wed, 17 November 2004 14:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: efthym.gmx.net

External includes dont work even in managed builds. I used
'$(shell sdl-config --cflags)' in the Build->Compiler->Miscellaneous and=

'$(shell sdl-config --libs)' in Build->Linker->Miscellaneous
(is this right ??)

As for the includes, they dont seem to work even if managed build is use=
d.
If set the relative path in the include statement, the file is found. I'=
m =

using an external library SDLGUI. So I have

'#include <SDL/SDLGUI.h>'
and the compiler stops complaining about the missing file. but then I ge=
t

arraysR.o(.text+0x35): In function `cont()':
: undefined reference to `SDLGUI::GetItem(int)'

The GetItem() method is public in the SDLGUI.h . For some reason though=
=

it doesn't find it. This goes for all methods in SDLGUI that are =

referenced in arraysR.cpp.

Maybe I'm missing something.

Efthymios


On Wed, 17 Nov 2004 13:44:55 -0500, Doug Schaefer <dschaefe@ca.ibm.com> =
=

wrote:

> "Martin Wood" <martin@ideaworks3d.com> wrote in message
> news:cnftoj$249$1@www.eclipse.org...
>> thinking about it, this seems to imply that the option of adding an
> external include path doesnt have any effect for
>> an unmanaged build. (I tried using the same setup as you and got the =
=

>> same
> results)
>
> You are correct, as far as the build goes. The Include Paths in the
> properties of standard make are used by CDT's internal parser for all =
our
> parser based features such as search, content assist, etc.
>
>>
>> I havent tried this using a managed build, which I think would work =

>> using
> the external paths because the managed build
>> manager would just write this into the makefile.
>
> I have successfully used managed make with SDL. Simply put the output =
of
> sdl-config in the right spots in the managed make properties. This stu=
ff
> should be pretty static anyway.
>
> Cheers,
> Doug
>
>>
>> so i think it all makes sense.
>>
>> martin
>>
>> Martin Wood wrote:
>> > Try using
>> >
>> > #include <SDL/SDL.h>
>> >
>> > which means you shouldnt need to add the external include path in t=
he
>> > project properties (assuming the /usr/include is in your default =

>> include
>> > path)
>> >
>> > good luck
>> >
>> > martin
>> >
>> >
>> > Efthym wrote:
>> >
>> >> Hi Doug,
>> >>
>> >> I tried the Managed Make project but couldn't get anywhere with th=
at.
>> >> In the Unmanaged Make Project, i put the includes under
>> >> Project->Properties->Include Paths->Add external include. There I =
put
>> >> "/usr/include/SDL". After that, the path is shown in the C/C++
>> >> Project View .
>> >> In the makefile I have "SDL_CFLAGS :=3D $(shell sdl-config --cflag=
s)" =

>> and
>> >> "SDL_LDFLAGS :=3D $(shell sdl-config --libs)"
>> >>
>> >> There is only one main.cpp file in my project which "include =

>> <SDL.h>".
>> >> When I try to compile, I keep getting a "SDL.h: No such file or
>> >> directory". All the rest of the errors I think are caused because =
of
>> >> this).
>> >>
>> >> I hope this helps.
>> >> Thanx
>> >>
>> >> Efthym
>> >>
>
>
Re: CDT and SDL howto ?? [message #128117 is a reply to message #127576] Sun, 21 November 2004 17:15 Go to previous messageGo to next message
Eclipse UserFriend
Efthym,
That's a linker error. If we are talking about a managed build project,
have you set the library paths (or specified the libraries to link
against) for the linker tool? It's worth taking a look.

Sean

Efthym wrote:
> External includes dont work even in managed builds. I used
> '$(shell sdl-config --cflags)' in the Build->Compiler->Miscellaneous and
> '$(shell sdl-config --libs)' in Build->Linker->Miscellaneous
> (is this right ??)
>
> As for the includes, they dont seem to work even if managed build is used.
> If set the relative path in the include statement, the file is found.
> I'm using an external library SDLGUI. So I have
>
> '#include <SDL/SDLGUI.h>'
> and the compiler stops complaining about the missing file. but then I get
>
> arraysR.o(.text+0x35): In function `cont()':
> : undefined reference to `SDLGUI::GetItem(int)'
>
> The GetItem() method is public in the SDLGUI.h . For some reason
> though it doesn't find it. This goes for all methods in SDLGUI that
> are referenced in arraysR.cpp.
>
> Maybe I'm missing something.
>
> Efthymios
>
>
> On Wed, 17 Nov 2004 13:44:55 -0500, Doug Schaefer <dschaefe@ca.ibm.com>
> wrote:
>
>> "Martin Wood" <martin@ideaworks3d.com> wrote in message
>> news:cnftoj$249$1@www.eclipse.org...
>>
>>> thinking about it, this seems to imply that the option of adding an
>>
>> external include path doesnt have any effect for
>>
>>> an unmanaged build. (I tried using the same setup as you and got the
>>> same
>>
>> results)
>>
>> You are correct, as far as the build goes. The Include Paths in the
>> properties of standard make are used by CDT's internal parser for all our
>> parser based features such as search, content assist, etc.
>>
>>>
>>> I havent tried this using a managed build, which I think would work
>>> using
>>
>> the external paths because the managed build
>>
>>> manager would just write this into the makefile.
>>
>>
>> I have successfully used managed make with SDL. Simply put the output of
>> sdl-config in the right spots in the managed make properties. This stuff
>> should be pretty static anyway.
>>
>> Cheers,
>> Doug
>>
>>>
>>> so i think it all makes sense.
>>>
>>> martin
>>>
>>> Martin Wood wrote:
>>> > Try using
>>> >
>>> > #include <SDL/SDL.h>
>>> >
>>> > which means you shouldnt need to add the external include path in the
>>> > project properties (assuming the /usr/include is in your default
>>> include
>>> > path)
>>> >
>>> > good luck
>>> >
>>> > martin
>>> >
>>> >
>>> > Efthym wrote:
>>> >
>>> >> Hi Doug,
>>> >>
>>> >> I tried the Managed Make project but couldn't get anywhere with that.
>>> >> In the Unmanaged Make Project, i put the includes under
>>> >> Project->Properties->Include Paths->Add external include. There I put
>>> >> "/usr/include/SDL". After that, the path is shown in the C/C++
>>> >> Project View .
>>> >> In the makefile I have "SDL_CFLAGS := $(shell sdl-config
>>> --cflags)" and
>>> >> "SDL_LDFLAGS := $(shell sdl-config --libs)"
>>> >>
>>> >> There is only one main.cpp file in my project which "include
>>> <SDL.h>".
>>> >> When I try to compile, I keep getting a "SDL.h: No such file or
>>> >> directory". All the rest of the errors I think are caused because of
>>> >> this).
>>> >>
>>> >> I hope this helps.
>>> >> Thanx
>>> >>
>>> >> Efthym
>>> >>
>>
>>
>>
>
Re: CDT and SDL howto ?? [message #128130 is a reply to message #128117] Sun, 21 November 2004 21:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: efthym.gmx.net

Hi Sean,

can you be more specific please. I'm kinda new at this. This is a manage=
d =

project.
I tried adding libSDL.a libSDLmain.a with the '-l' option. Is this corre=
ct =

? This is what I get

Building target: ArraysRevisited
g++ -L/usr/lib -lSDL -lpthread -o ArraysRevisited arraysR.o =

-l/usr/lib/libSDL.a -l/usr/lib/libSDLmain.a
/usr/bin/ld: cannot find -l/usr/lib/libSDL.a
collect2: ld returned 1 exit status

I checked and the file is there. Still stuck ....

Efthym



On Sun, 21 Nov 2004 17:15:04 -0500, Sean Evoy <sevoy@ca.ibm.com> wrote:

> Efthym,
> That's a linker error. If we are talking about a managed build project=
, =

> have you set the library paths (or specified the libraries to link =

> against) for the linker tool? It's worth taking a look.
>
> Sean
>
> Efthym wrote:
>> External includes dont work even in managed builds. I used
>> '$(shell sdl-config --cflags)' in the Build->Compiler->Miscellaneous =
and
>> '$(shell sdl-config --libs)' in Build->Linker->Miscellaneous
>> (is this right ??)
>> As for the includes, they dont seem to work even if managed build is=
=

>> used.
>> If set the relative path in the include statement, the file is found.=
=

>> I'm using an external library SDLGUI. So I have
>> '#include <SDL/SDLGUI.h>'
>> and the compiler stops complaining about the missing file. but then I=
=

>> get
>> arraysR.o(.text+0x35): In function `cont()':
>> : undefined reference to `SDLGUI::GetItem(int)'
>> The GetItem() method is public in the SDLGUI.h . For some reason =

>> though it doesn't find it. This goes for all methods in SDLGUI that =
=

>> are referenced in arraysR.cpp.
>> Maybe I'm missing something.
>> Efthymios
>> On Wed, 17 Nov 2004 13:44:55 -0500, Doug Schaefer =

>> <dschaefe@ca.ibm.com> wrote:
>>
>>> "Martin Wood" <martin@ideaworks3d.com> wrote in message
>>> news:cnftoj$249$1@www.eclipse.org...
>>>
>>>> thinking about it, this seems to imply that the option of adding an=

>>>
>>> external include path doesnt have any effect for
>>>
>>>> an unmanaged build. (I tried using the same setup as you and got th=
e =

>>>> same
>>>
>>> results)
>>>
>>> You are correct, as far as the build goes. The Include Paths in the
>>> properties of standard make are used by CDT's internal parser for al=
l =

>>> our
>>> parser based features such as search, content assist, etc.
>>>
>>>>
>>>> I havent tried this using a managed build, which I think would work=
=

>>>> using
>>>
>>> the external paths because the managed build
>>>
>>>> manager would just write this into the makefile.
>>>
>>>
>>> I have successfully used managed make with SDL. Simply put the outpu=
t =

>>> of
>>> sdl-config in the right spots in the managed make properties. This =

>>> stuff
>>> should be pretty static anyway.
>>>
>>> Cheers,
>>> Doug
>>>
>>>>
>>>> so i think it all makes sense.
>>>>
>>>> martin
>>>>
>>>> Martin Wood wrote:
>>>> > Try using
>>>> >
>>>> > #include <SDL/SDL.h>
>>>> >
>>>> > which means you shouldnt need to add the external include path in=
=

>>>> the
>>>> > project properties (assuming the /usr/include is in your default =
=

>>>> include
>>>> > path)
>>>> >
>>>> > good luck
>>>> >
>>>> > martin
>>>> >
>>>> >
>>>> > Efthym wrote:
>>>> >
>>>> >> Hi Doug,
>>>> >>
>>>> >> I tried the Managed Make project but couldn't get anywhere with =
=

>>>> that.
>>>> >> In the Unmanaged Make Project, i put the includes under
>>>> >> Project->Properties->Include Paths->Add external include. There =
I =

>>>> put
>>>> >> "/usr/include/SDL". After that, the path is shown in the C/C++
>>>> >> Project View .
>>>> >> In the makefile I have "SDL_CFLAGS :=3D $(shell sdl-config =

>>>> --cflags)" and
>>>> >> "SDL_LDFLAGS :=3D $(shell sdl-config --libs)"
>>>> >>
>>>> >> There is only one main.cpp file in my project which "include =

>>>> <SDL.h>".
>>>> >> When I try to compile, I keep getting a "SDL.h: No such file or
>>>> >> directory". All the rest of the errors I think are caused becaus=
e =

>>>> of
>>>> >> this).
>>>> >>
>>>> >> I hope this helps.
>>>> >> Thanx
>>>> >>
>>>> >> Efthym
>>>> >>
>>>
>>>
>>>
>>
Re: CDT and SDL howto ?? [message #128408 is a reply to message #128130] Tue, 23 November 2004 13:47 Go to previous messageGo to next message
Eclipse UserFriend
Hi Efthym,
When you pass a library to the linker, you typically break the
specification in two.

The first part is to specify the path to the libraries using the -L
flag, as you have done in the example output with "-L/usr/lib". This
tell the linker to add "/usr/lib" to its internal list of search
directories.

The second part is to specify the libraries themselves. Here, you use
the flag -l<name> and the linker adds the prefix "lib" and the extension
".a". In the output below, "-lSDL" will be expanded by the linker to
libSDL.a so you should not specify the full name. What is the argument
"-l/usr/lib/libSDLmain.a" for? If you have to link that library too, you
should add "SDLmain" to the list of libraries in the linker tool settings.

Anyway, let me know if this suggestion helped.

Sean

Efthym wrote:
> Hi Sean,
>
> can you be more specific please. I'm kinda new at this. This is a
> managed project.
> I tried adding libSDL.a libSDLmain.a with the '-l' option. Is this
> correct ? This is what I get
>
> Building target: ArraysRevisited
> g++ -L/usr/lib -lSDL -lpthread -o ArraysRevisited arraysR.o
> -l/usr/lib/libSDL.a -l/usr/lib/libSDLmain.a
> /usr/bin/ld: cannot find -l/usr/lib/libSDL.a
> collect2: ld returned 1 exit status
>
> I checked and the file is there. Still stuck ....
>
> Efthym
>
>
>
> On Sun, 21 Nov 2004 17:15:04 -0500, Sean Evoy <sevoy@ca.ibm.com> wrote:
>
>> Efthym,
>> That's a linker error. If we are talking about a managed build
>> project, have you set the library paths (or specified the libraries
>> to link against) for the linker tool? It's worth taking a look.
>>
>> Sean
>>
>> Efthym wrote:
>>
>>> External includes dont work even in managed builds. I used
>>> '$(shell sdl-config --cflags)' in the Build->Compiler->Miscellaneous and
>>> '$(shell sdl-config --libs)' in Build->Linker->Miscellaneous
>>> (is this right ??)
>>> As for the includes, they dont seem to work even if managed build
>>> is used.
>>> If set the relative path in the include statement, the file is
>>> found. I'm using an external library SDLGUI. So I have
>>> '#include <SDL/SDLGUI.h>'
>>> and the compiler stops complaining about the missing file. but then
>>> I get
>>> arraysR.o(.text+0x35): In function `cont()':
>>> : undefined reference to `SDLGUI::GetItem(int)'
>>> The GetItem() method is public in the SDLGUI.h . For some reason
>>> though it doesn't find it. This goes for all methods in SDLGUI that
>>> are referenced in arraysR.cpp.
>>> Maybe I'm missing something.
>>> Efthymios
>>> On Wed, 17 Nov 2004 13:44:55 -0500, Doug Schaefer
>>> <dschaefe@ca.ibm.com> wrote:
>>>
>>>> "Martin Wood" <martin@ideaworks3d.com> wrote in message
>>>> news:cnftoj$249$1@www.eclipse.org...
>>>>
>>>>> thinking about it, this seems to imply that the option of adding an
>>>>
>>>>
>>>> external include path doesnt have any effect for
>>>>
>>>>> an unmanaged build. (I tried using the same setup as you and got
>>>>> the same
>>>>
>>>>
>>>> results)
>>>>
>>>> You are correct, as far as the build goes. The Include Paths in the
>>>> properties of standard make are used by CDT's internal parser for
>>>> all our
>>>> parser based features such as search, content assist, etc.
>>>>
>>>>>
>>>>> I havent tried this using a managed build, which I think would
>>>>> work using
>>>>
>>>>
>>>> the external paths because the managed build
>>>>
>>>>> manager would just write this into the makefile.
>>>>
>>>>
>>>>
>>>> I have successfully used managed make with SDL. Simply put the
>>>> output of
>>>> sdl-config in the right spots in the managed make properties. This
>>>> stuff
>>>> should be pretty static anyway.
>>>>
>>>> Cheers,
>>>> Doug
>>>>
>>>>>
>>>>> so i think it all makes sense.
>>>>>
>>>>> martin
>>>>>
>>>>> Martin Wood wrote:
>>>>> > Try using
>>>>> >
>>>>> > #include <SDL/SDL.h>
>>>>> >
>>>>> > which means you shouldnt need to add the external include path
>>>>> in the
>>>>> > project properties (assuming the /usr/include is in your
>>>>> default include
>>>>> > path)
>>>>> >
>>>>> > good luck
>>>>> >
>>>>> > martin
>>>>> >
>>>>> >
>>>>> > Efthym wrote:
>>>>> >
>>>>> >> Hi Doug,
>>>>> >>
>>>>> >> I tried the Managed Make project but couldn't get anywhere with
>>>>> that.
>>>>> >> In the Unmanaged Make Project, i put the includes under
>>>>> >> Project->Properties->Include Paths->Add external include. There
>>>>> I put
>>>>> >> "/usr/include/SDL". After that, the path is shown in the C/C++
>>>>> >> Project View .
>>>>> >> In the makefile I have "SDL_CFLAGS := $(shell sdl-config
>>>>> --cflags)" and
>>>>> >> "SDL_LDFLAGS := $(shell sdl-config --libs)"
>>>>> >>
>>>>> >> There is only one main.cpp file in my project which "include
>>>>> <SDL.h>".
>>>>> >> When I try to compile, I keep getting a "SDL.h: No such file or
>>>>> >> directory". All the rest of the errors I think are caused
>>>>> because of
>>>>> >> this).
>>>>> >>
>>>>> >> I hope this helps.
>>>>> >> Thanx
>>>>> >>
>>>>> >> Efthym
>>>>> >>
>>>>
>>>>
>>>>
>>>>
>>>
>
Re: CDT and SDL howto ?? [message #128448 is a reply to message #128408] Tue, 23 November 2004 17:22 Go to previous message
Eclipse UserFriend
Originally posted by: efthym.gmx.net

Thanx for the tip Sean,
I'll try it and let you know

Efthym


On Tue, 23 Nov 2004 13:47:13 -0500, Sean Evoy <sevoy@ca.ibm.com> wrote:

> Hi Efthym,
> When you pass a library to the linker, you typically break the =

> specification in two.
>
> The first part is to specify the path to the libraries using the -L =

> flag, as you have done in the example output with "-L/usr/lib". This =

> tell the linker to add "/usr/lib" to its internal list of search =

> directories.
>
> The second part is to specify the libraries themselves. Here, you use =
=

> the flag -l<name> and the linker adds the prefix "lib" and the extensi=
on =

> ".a". In the output below, "-lSDL" will be expanded by the linker to =

> libSDL.a so you should not specify the full name. What is the argument=
=

> "-l/usr/lib/libSDLmain.a" for? If you have to link that library too, y=
ou =

> should add "SDLmain" to the list of libraries in the linker tool =

> settings.
>
> Anyway, let me know if this suggestion helped.
>
> Sean
>
> Efthym wrote:
>> Hi Sean,
>> can you be more specific please. I'm kinda new at this. This is a =

>> managed project.
>> I tried adding libSDL.a libSDLmain.a with the '-l' option. Is this =

>> correct ? This is what I get
>> Building target: ArraysRevisited
>> g++ -L/usr/lib -lSDL -lpthread -o ArraysRevisited arraysR.o =

>> -l/usr/lib/libSDL.a -l/usr/lib/libSDLmain.a
>> /usr/bin/ld: cannot find -l/usr/lib/libSDL.a
>> collect2: ld returned 1 exit status
>> I checked and the file is there. Still stuck ....
>> Efthym
>> On Sun, 21 Nov 2004 17:15:04 -0500, Sean Evoy <sevoy@ca.ibm.com> =

>> wrote:
>>
>>> Efthym,
>>> That's a linker error. If we are talking about a managed build =

>>> project, have you set the library paths (or specified the libraries=
=

>>> to link against) for the linker tool? It's worth taking a look.
>>>
>>> Sean
>>>
>>> Efthym wrote:
>>>
>>>> External includes dont work even in managed builds. I used
>>>> '$(shell sdl-config --cflags)' in the Build->Compiler->Miscellaneou=
s =

>>>> and
>>>> '$(shell sdl-config --libs)' in Build->Linker->Miscellaneous
>>>> (is this right ??)
>>>> As for the includes, they dont seem to work even if managed build =
=

>>>> is used.
>>>> If set the relative path in the include statement, the file is =

>>>> found. I'm using an external library SDLGUI. So I have
>>>> '#include <SDL/SDLGUI.h>'
>>>> and the compiler stops complaining about the missing file. but then=
=

>>>> I get
>>>> arraysR.o(.text+0x35): In function `cont()':
>>>> : undefined reference to `SDLGUI::GetItem(int)'
>>>> The GetItem() method is public in the SDLGUI.h . For some reason =
=

>>>> though it doesn't find it. This goes for all methods in SDLGUI tha=
t =

>>>> are referenced in arraysR.cpp.
>>>> Maybe I'm missing something.
>>>> Efthymios
>>>> On Wed, 17 Nov 2004 13:44:55 -0500, Doug Schaefer =

>>>> <dschaefe@ca.ibm.com> wrote:
>>>>
>>>>> "Martin Wood" <martin@ideaworks3d.com> wrote in message
>>>>> news:cnftoj$249$1@www.eclipse.org...
>>>>>
>>>>>> thinking about it, this seems to imply that the option of adding =
an
>>>>>
>>>>>
>>>>> external include path doesnt have any effect for
>>>>>
>>>>>> an unmanaged build. (I tried using the same setup as you and got =
=

>>>>>> the same
>>>>>
>>>>>
>>>>> results)
>>>>>
>>>>> You are correct, as far as the build goes. The Include Paths in th=
e
>>>>> properties of standard make are used by CDT's internal parser for =
=

>>>>> all our
>>>>> parser based features such as search, content assist, etc.
>>>>>
>>>>>>
>>>>>> I havent tried this using a managed build, which I think would =

>>>>>> work using
>>>>>
>>>>>
>>>>> the external paths because the managed build
>>>>>
>>>>>> manager would just write this into the makefile.
>>>>>
>>>>>
>>>>>
>>>>> I have successfully used managed make with SDL. Simply put the =

>>>>> output of
>>>>> sdl-config in the right spots in the managed make properties. This=
=

>>>>> stuff
>>>>> should be pretty static anyway.
>>>>>
>>>>> Cheers,
>>>>> Doug
>>>>>
>>>>>>
>>>>>> so i think it all makes sense.
>>>>>>
>>>>>> martin
>>>>>>
>>>>>> Martin Wood wrote:
>>>>>> > Try using
>>>>>> >
>>>>>> > #include <SDL/SDL.h>
>>>>>> >
>>>>>> > which means you shouldnt need to add the external include path =
=

>>>>>> in the
>>>>>> > project properties (assuming the /usr/include is in your =

>>>>>> default include
>>>>>> > path)
>>>>>> >
>>>>>> > good luck
>>>>>> >
>>>>>> > martin
>>>>>> >
>>>>>> >
>>>>>> > Efthym wrote:
>>>>>> >
>>>>>> >> Hi Doug,
>>>>>> >>
>>>>>> >> I tried the Managed Make project but couldn't get anywhere wit=
h =

>>>>>> that.
>>>>>> >> In the Unmanaged Make Project, i put the includes under
>>>>>> >> Project->Properties->Include Paths->Add external include. Ther=
e =

>>>>>> I put
>>>>>> >> "/usr/include/SDL". After that, the path is shown in the C/C++=

>>>>>> >> Project View .
>>>>>> >> In the makefile I have "SDL_CFLAGS :=3D $(shell sdl-config =

>>>>>> --cflags)" and
>>>>>> >> "SDL_LDFLAGS :=3D $(shell sdl-config --libs)"
>>>>>> >>
>>>>>> >> There is only one main.cpp file in my project which "include =
=

>>>>>> <SDL.h>".
>>>>>> >> When I try to compile, I keep getting a "SDL.h: No such file o=
r
>>>>>> >> directory". All the rest of the errors I think are caused =

>>>>>> because of
>>>>>> >> this).
>>>>>> >>
>>>>>> >> I hope this helps.
>>>>>> >> Thanx
>>>>>> >>
>>>>>> >> Efthym
>>>>>> >>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>
Previous Topic:includes
Next Topic:Useful C++ CDT debugging with MinGW, Cygwin???
Goto Forum:
  


Current Time: Sun Apr 27 01:50:48 EDT 2025

Powered by FUDForum. Page generated in 0.03879 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top