Mac finding .h files.

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
I do not get an error message from this include in main.
#include "./gsl-1.13/linalg/gsl_linalg.h"
But in gsl_linalg.h this include


#ifndef __GSL_LINALG_H__
#define __GSL_LINALG_H__
#include "./gsl-1.13/gsl_mode.h"
gives me an error saying no such file or directory.
Its there. I checked.
 

willieva

macrumors 6502
Mar 12, 2010
274
0
gsl-1.13 is located where your main is, so the include statement finds gsl_linalg.h

When the include statement from that file is read in, it is looking for gsl-1.13 relative to gsl_linalg.h, and can't find it because gsl-1.13 isn't where gsl_linalg.h is. gsl-1.13 is locate at ../../gsl-1.13 relative to gsl_linalg.h

You could edit the gsl_linalg.h include statement to give it the proper path, or compile with -I. so the include path has the directory your main program is in.
 

thundersteele

macrumors 68030
Oct 19, 2011
2,984
7
Switzerland
Have you tried giving the absolute path to the file?

I installed GSL into the default directory, so I just have to
#include <gsl/gsl_blah.h>

Are you sure that gsl_mode.h is the correct file to include.
 

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
So I started from scratch.
The #include seems to be right but I get linker errors which is not surprising ( I think) because I haven't told Xcode 4 where the libraries are. How do to I do that?
thanks
 

jiminaus

macrumors 65816
Dec 16, 2010
1,449
1
Sydney
  1. Click on your project in the project navigator.
  2. Click on your target in the project editor.
  3. Go into the Build Phases
  4. Expand Link Binary With Libraries
  5. Add your libraries here
 

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
If I've followed your directions properly,everything under Add Build Phase is grey out.
If I run what I have, (I just added everything that seem relavent to the project). It looks for files in Downloads when I moved and made the libraries in Documents.
 

farmerdoug

macrumors 6502a
Original poster
Sep 16, 2008
541
0
Okay. Found the Build Phases. All the Libraries are there; I added them to the project in the project navigator. The program even runs to a point. Then I get this:

0.000000 46.847527 50.790520 55.977997
dyld: lazy symbol binding failed: Symbol not found: _cblas_dtrsv
Referenced from: /usr/local/lib/libgsl.0.dylib
Expected in: flat namespace

dyld: Symbol not found: _cblas_dtrsv
Referenced from: /usr/local/lib/libgsl.0.dylib
Expected in: flat namespace
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.