LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Cygwin & makefiles - not finding files in -I'd directory (https://www.linuxquestions.org/questions/programming-9/cygwin-and-makefiles-not-finding-files-in-id-directory-582266/)

BrianK 09-04-2007 11:20 PM

Cygwin & makefiles - not finding files in -I'd directory
 
This is a bit cryptic, but here's the info I have...

My Makefile looks something like:
Code:

INCDIR = -I~/HDKProjects/Hydrous2/WaveTools2/WaveTools/ \
        -I~/HDKProjects/MLInclude/ \
        -I~/HDKProjects/Hydrous2/OPs/Standalone

 # ....

%.o: %.C
        $(CC) $(OBJFLAGS) $(INCDIR) -DMAKING_DSO $(TAGINFO) $< $(OBJOUTPUT)$@

#.....

... there's more to it, but those are the important bits & what I'm currently trying to compile.

The first file it tries to compile has an include like so:

Code:

#include <SampledWave.h>
Where SampledWave.h is in ~/HDKProjects/Hydrous2/WaveTools2/WaveTools/

However, when I try to compile, I get a "fatal error, can not open included file 'SampledWave.h': No such file or directory."

I've checked that I have read permissions. I've copy/pasted all paths from the make file into cygwin to be sure there are no spelling/capitalization errors, I've tried removing the '~' & using the full path, I've tried with a space after the "-I" & without. I've tried putting a link to ~/HDKProjects/Hydrous2/WaveTools2/WaveTools/ in /usr/include & then changed the #include to be <foo/SampledWave.h>. Nothing seems to work.

If it helps, this is what the makefile spits out for the compile line:

Code:

> make
c:/Progra~1/Micros~1.net/Vc7/bin/cl -TP -MD -GX -GR -c -DVERSION="8.0.383" -DI38
6 -DWIN32 -DSWAP_BITFIELDS -DDLLEXPORT="__declspec(dllexport)" -DSESI_LITTLE_END
IAN -DOFSTREAM_PERMISSIONS=", 0666"  -Ic:/HFS80~1.383/toolkit/include -Ic:/HFS80
~1.383/custom/include -Ic:/Progra~1/Micros~1.net/Vc7/include  -Od -I/home/BrianK
_Labs/HDKProjects/Hydrous2/WaveTools2/WaveTools/ -I~/HDKProjects/MLInclude/ -I~/
HDKProjects/Hydrous2/OPs/Standalone -DMAKING_DSO -DUT_DSO_TAGINFO='"3262197cbf3f
480637af0c866b3b93ef0b43d0e2cc37cbbd73a8c3063d69ee812b972985db32267a5946d9fd22da
42591beee110fdd3e354470c2fe1779ae5d85bac55b0e8b84994a3268d0847ba11bef254d59d8ef0
8d6df2b8711915198141fe4ce6558d2b83"' HT_Ocean.C -FoHT_Ocean.o
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

HT_Ocean.C
c:\cygwin\home\BrianK_Labs\HDKProjects\Hydrous2\Vex\HT_Liquid.h(25) : fatal erro
r C1083: Cannot open include file: 'SampledWave.h': No such file or directory

ideas?

carl.waldbieser 09-05-2007 05:13 AM

It's been a while, but could the cl compiler not like the UNIX style paths you give it for the include files?

purplerice 09-05-2007 01:07 PM

I have not touched C for a while. I wonder if you have tried
#include "SampledWave.h"
or
#include "full path to SampledWave.h"

I remember that C compiler uses different algorithms to search for <xyz.h> than "xyz.h". (check the reference of cl)

BrianK 09-19-2007 11:50 PM

Quote:

Originally Posted by carl.waldbieser (Post 2881788)
It's been a while, but could the cl compiler not like the UNIX style paths you give it for the include files?

That was it. Thanks!

matthewg42 09-20-2007 04:45 AM

In Makefile, instead of ~, you could use the HOME environment variable, i.e.
Code:

INCDIR = -I$HOME/HDKProjects/Hydrous2/WaveTools2/WaveTools/ \
        -I$HOME/HDKProjects/MLInclude/ \
        -I$HOME/HDKProjects/Hydrous2/OPs/Standalone
...


gnashley 09-20-2007 06:10 AM

The expansion of '~' to equal your $HOME directory is a BASH feature and is not supported by 'make'.
Sometimes you may need to set LD_LIBRARY_PATH or, more to your case, C_INCLUDE_PATH when using Mingw32 or cygwin

BrianK 09-20-2007 11:46 AM

Quote:

Originally Posted by gnashley (Post 2897718)
The expansion of '~' to equal your $HOME directory is a BASH feature and is not supported by 'make'.
Sometimes you may need to set LD_LIBRARY_PATH or, more to your case, C_INCLUDE_PATH when using Mingw32 or cygwin

I'm guessing you're speaking of cygwin? '~' in makefiles works fine on my Debian, Ubuntu, and Suse machines.

Either way, using the full path (i.e. c:/cygwin/home/...) or $HOME works, so I'm all set.

;)


All times are GMT -5. The time now is 04:33 PM.