gcc and g++ library search paths

I had all my code compiling under a system that had gcc 4.1.1 and g++ 4.1.1. IT just gave me another system , that had gcc 4.1.2 and g++ 4.1.2. When I run with -v option, it says

ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../x86_64-redhat-linux/include"

However find gives me this

find /usr -name stddef.h
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stddef.h

How do I force gcc to use a different search paths for i386 and 4.1.1, rather than 4.1.2 and x86_64 ?


This would indicate that the installation of gcc isn't complete. You may need to install (eg sudo yum install libstdc++-devel glibc-devel ). This will work assuming that the gcc was actually installed using the standard packages from redhat. You may of course need some other libraries too, depending on what you are actually developing.

Of course, the RIGHT thing to do is to complain to IT, but I suspect that if you want some work done today (if your IT is anything like the ones I've worked with), you're better off doing it yourself, if you at all can do that. (Oh, and most of the time, in my experience, they have no idea how to solve the problem, so give them the above information!).


You can extend searched with -I for includes and -L for libs parameter followed by desired paths. See more in the documentation or this answer

链接地址: http://www.djcxy.com/p/49186.html

上一篇: 加载一个简单的数组

下一篇: gcc和g ++库搜索路径