1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MinGW/MSYS problem with search path

  1. Feb 3, 2009 #1


    User Avatar
    Science Advisor
    Homework Helper

    Since my plans for a Linux system are on hold, I'm trying to shore up my Windows machine to do some calculations.

    I've been having trouble with MinGW/MSYS lately. I was able to compile GMP, but wasn't able to do anything with it -- anything I did gave me error messages saying it couldn't find gmp.h. (And yes, I did a make install.)

    After searching through the settings, I found that it was nothing more than a problem with my search directories: if I compiled with
    Code (Text):
    gcc blah.c -o blah -I /usr/local/include -L /usr/local/lib -lgmp
    rather than simply
    Code (Text):
    gcc blah.c -o blah -lgmp
    it worked properly. But when I'm making a large piece of software, I can't just change all gcc command lines in the makefile -- I don't even know how half the thing works, let alone how to properly modify it.

    This seems like a problem with a simple solution, but I haven't been able to find it. I can modify the $PATH to include both directories, but that doesn't work. I tried passing --libdir and --includedir to configure, but that had no apparent effect at all.

    Any ideas?
  2. jcsd
  3. Feb 4, 2009 #2


    User Avatar
    Science Advisor
    Homework Helper

    See http://www.mingw.org/wiki/IncludePathHOWTO
    It doesn't look like there is an INCLUDE_PATH or LIBRARY_PATH you can set globally, in a makefile it's normal to have a variable that expands out to these at the top.
    Last edited: Feb 4, 2009
  4. Feb 12, 2009 #3


    User Avatar
    Gold Member

    Actually, there may be. The page linked says
    and links to http://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html

    which says

    So setting CPATH (or maybe C_INCLUDE_PATH or CPLUS_INCLUDE_PATH) *should* do it. Alternately, you could try setting CFLAGS and LDFLAGS with the appropriate -I includes.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: MinGW/MSYS problem with search path