Keep getting the message No such file or directory
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have built and installed the GSL library in my home directory (instead of the default usr/local). libgsl.a is in myhomedir/lib and all header files are in myhomedir/include/gsl, including gsl_sf_bessel.h which I try to use.
I now try to compile program using a simple Makefile:
test: test.o
g++ test.cpp -I/user/myhomedir/include -L/user/myhomedir/lib libgsl.a -o test
when calling make, I keep getting the gsl/gsl_sf_bessel.h: No such file or directory ?????
What am I doing wrong?
Also, I wonder why make does not return any errors when I put a phony directory in, such as -I/phony/phony ?
Check for a mispelling, and check that the file actually exists. It should work whether you use angle brackets or double quotes.
I created an include directory in my home directory and moved a header file there. Adding the include directory argument for the command it worked as expected using first angle brackets and then double quotes.
I tried that, but keep getting the message. Furthermore, the -I/user/myhomedir/include option should instruct the compiler/linker of the locations to search.
When I type at the command prompt:
g++ -I/user/myhomedir/include -v test.cpp
I get the following (partial output) which indicates that the -I option has been set:
...
#include <...> search starts here:
/user/myhomedir/include
/usr/include/c++/3.2.3
...
That's why I don't understand why I keep getting the message!
My post mentioned that both ways should work, so cd to the gsl directory and make sure that that include file exists. Also check the permissions. Make sure the directory and the file are readable.
I'm wondering if maybe the problem is coming from "make" (and not, as we've been assuming, from the g++ compiler).
Suggestion:
Try compiling from the command prompt (you said you tried "-v", but you didn't say whether or not you actually tried a command-line compiler, or whether or not it worked).
Hmm...jschiwal
You edited your first message, because it didn't first say that both should work... Is that good practice? Anyway...
Yes I checked that the file exists, is in the correct location, and is editable. These files are in my home directory.
Thanks
Niko
Yes, I edited it just after posting it the first time. Sorry for the confusion.
Quote:
g++ test.cpp -I/user/myhomedir/include -L/user/myhomedir/lib libgsl.a -o test
If this command gives you that error, then the problem isn't due to make because make isn't used. The verbose command might give more information, but taking the error message at its word and checking the file it is complaining about seems like the best bet.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.