Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / February 2005



Tip: Looking for answers? Try searching our database.

Another missing header problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
C Lund - 22 Feb 2005 09:42 GMT
I downloaded and installed Speex (www.speex.org/) by following the
instructions:

Download http://www.speex.org/download/speex-1.0.tar.gz
     (1.0 Source Code)
  Uncompress
  Open Terminal
  cd into speex directory
  setenv CFLAGS -O3
  ./configure --enable-shared=no
  make
  Make directory /Library/Application Support/Speex
  Move speex-1.0 directory into /Library/Application Support/Speex

When I compile I get "speex.h: No such file or directory", and the
"include" line is:

  #include "speex.h"

However, Speex is not a framework, and simply adding speex.h to the
project and changing the include statement to:

  #include "libspeex/speex.h"

doesn't work.

"speex.h" is located in

  (hard drive)/Library/Application Support/Speex/speex-1.0/libspeex/

What should the "include" line be in order for this to work?

Signature

C Lund, www.notam02.no/~clund

Michael Ash - 23 Feb 2005 07:24 GMT
> I downloaded and installed Speex (www.speex.org/) by following the
> instructions:
[quoted text clipped - 9 lines]
>   Make directory /Library/Application Support/Speex
>   Move speex-1.0 directory into /Library/Application Support/Speex

Application Support is a rather odd place for a unix library to live...
but whatever floats your boat.

> When I compile I get "speex.h: No such file or directory", and the
> "include" line is:
[quoted text clipped - 13 lines]
>
> What should the "include" line be in order for this to work?

You're doing two things wrong here.

First, it's a system header (meaning it's not part of your project), so
you need to use <> when you #include it, like so: #include <speex.h>. It's
not in a framework, so you don't give the library name before the header,
just the header name itself.

Second, your path is not a standard place for headers, so the compiler
doesn't know that it has to look there. Frameworks have headers and the
library bundled together so the compiler can find everything, but naked
libraries don't, and you have to tell it where to find them manually. You
can do this by adding a flag like this to your compiler flags:

-I'/Library/Application Support/Speex...'

The '...' should be the path to the directory where the headers actually
live.
C Lund - 23 Feb 2005 15:59 GMT
> > I downloaded and installed Speex (www.speex.org/) by following the
> > instructions:

(snip)

> >   Make directory /Library/Application Support/Speex
> >   Move speex-1.0 directory into /Library/Application Support/Speex
> Application Support is a rather odd place for a unix library to live...

I agree.

> but whatever floats your boat.

If it was my boat, I would have floated it elsewhere. Lua (another
cross-platform library) is also in the App Support folder. I don't
seem to be having any problems with Lua though.

(speex)

> > What should the "include" line be in order for this to work?
> You're doing two things wrong here.

> First, it's a system header (meaning it's not part of your project), so
> you need to use <> when you #include it, like so: #include <speex.h>. It's
> not in a framework, so you don't give the library name before the header,
> just the header name itself.

> Second, your path is not a standard place for headers, so the compiler
> doesn't know that it has to look there. Frameworks have headers and the
[quoted text clipped - 3 lines]
>
> -I'/Library/Application Support/Speex...'

I made the changes you suggested, and they worked where the "include"
statements were in .cpp files. But there is an instance where the
"include" was in a header file. PB can't locate speex.h there, for
some reason.

I've never set any compiler flags before, so just to make sure I got
it right;

For each file that has an "include <speex.h>" line, I selected the
file, clicked the blue "i" (info) button, selected the "build" tab,
and then pasted

  -I'/Library/Application Support/Speex/speex-1.0/libspeex'

in the text space. Was that the correct procedure? Again - it seemed
to work for the .cpp files, but not the .h file.

Signature

C Lund, www.notam02.no/~clund

Michael Ash - 23 Feb 2005 17:43 GMT
>> First, it's a system header (meaning it's not part of your project), so
>> you need to use <> when you #include it, like so: #include <speex.h>. It's
[quoted text clipped - 25 lines]
> in the text space. Was that the correct procedure? Again - it seemed
> to work for the .cpp files, but not the .h file.

This could work, but you're missing something. A header file isn't just
compiled by its corresponding implementation file. It's compiled by any
implementation file which includes it, by any implementation file which
includes a header which includes it, ad infinitum. You'd need to make this
change for every file in the project that matches these criteria as well.

However, this is not really the right way to do it. Just add the flag to
your target's flags, so that they get applied to every file in the
project, and you should be good to go. I've never had an occasion to set
an individual file's flags. I can imagine cases where it would be useful,
but this is certainly not one of them.
C Lund - 24 Feb 2005 11:38 GMT
> However, this is not really the right way to do it. Just add the flag to
> your target's flags, so that they get applied to every file in the
> project, and you should be good to go. I've never had an occasion to set
> an individual file's flags. I can imagine cases where it would be useful,
> but this is certainly not one of them.

I wasn't entirely sure how to do that in the targets, so I tried
pasting

  -I'/Library/Application Support/Speex/speex-1.0/libspeex'

into the "Other C compiler flags" fields (there are three targets to
this project). That gave me a cryptic error message, so I deleted it,
cleaned the targets, and compiled again. I am now getting another
error message I do not understand:

  ld: warning -L: directory name (/usr/local/lib) does not exist
  ld: warning prebinding disabled because of undefined symbols
  ld: Undefined symbols:
GameAvailableMetaserverAnnouncer::pumpAll()
GameAvailableMetaserverAnnouncer::GameAvailableMetaserverAnnouncer(game
_info const&)
GameAvailableMetaserverAnnouncer::~GameAvailableMetaserverAnnouncer()
  ld: warning -L: directory name (/usr/local/lib) does not exist
  ld: warning prebinding disabled because of undefined symbols
  ld: Undefined symbols:

This looks like it's related to a folder full of headers and .cpps
called "Metaserver", which resides in the same folder as the PB
project folder.

Too bad this project didn't come with a user's manual... B/

Signature

C Lund, www.notam02.no/~clund

Michael Ash - 24 Feb 2005 19:10 GMT
> I wasn't entirely sure how to do that in the targets, so I tried
> pasting
[quoted text clipped - 20 lines]
> called "Metaserver", which resides in the same folder as the PB
> project folder.

Either the Metaserver files aren't getting compiled, or the library that
they generate (if they generate one at all) isn't getting included in your
project. I can't say more than that.
C Lund - 24 Feb 2005 22:30 GMT
(these lines are here because my ISP - UPC - is being difficult.
Ignore)
(these lines are here because my ISP - UPC - is being difficult.
Ignore)
(these lines are here because my ISP - UPC - is being difficult.
Ignore)

> Either the Metaserver files aren't getting compiled, or the library that
> they generate (if they generate one at all) isn't getting included in your
> project.

It turned out that all I had to do was include the entire Metaserver
folder in the project, instead of just the metaserver.h file.

It compiles now. Thanks for your help. B)

Signature

C Lund, www.notam02.no/~clund

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.