C++ 使用glibc 2.7 include path编译失败

C++ 使用glibc 2.7 include path编译失败,c++,linux,compilation,glibc,C++,Linux,Compilation,Glibc,我已经在我的SLES 12.3g++7.3上编译到/FaF目录中 glibc 2.27已安装到/FaF/glibc目录中 用g++-c testAbs.cpp-I/FaF/glibc/include编译这个非常简单的程序失败得很厉害: #include <cstdlib> #include <cmath> int main( int argc, char * argv [] ) { if ( argc != 2 ) { return 1;

我已经在我的SLES 12.3
g++7.3
上编译到
/FaF
目录中
glibc 2.27
已安装到
/FaF/glibc
目录中

g++-c testAbs.cpp-I/FaF/glibc/include
编译这个非常简单的程序失败得很厉害:

#include <cstdlib>
#include <cmath>
int main( int argc, char * argv [] )
{
    if ( argc != 2 )
    {
        return 1;
    }
    return std::abs(std::atoi(argv[1]));
}

问题中的示例是我的include文件的最小化版本。这些都包括项目所需的文件:

#include <algorithm>
#include <atomic>
#include <chrono>
#include <cmath>
#include <condition_variable>
#include <cstdlib>
#include <forward_list>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <mutex>
#include <regex>
#include <set>
#include <string>
#include <thread>
#include <vector>
#include <execinfo.h>
#include <gnu/libc-version.h>
#include <libgen.h>
#include <locale.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/poll.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/sysinfo.h>
#include <unistd.h>
#include <mysql/my_global.h>
#include <mysql/mysql.h>
g++-xc++-E-v-
帮助我找出需要哪些包含路径

顺序很重要


-I/usr/include
必须是列表中的最后一个

问题中的示例是我的include文件的最小化版本。这些都包括项目所需的文件:

#include <algorithm>
#include <atomic>
#include <chrono>
#include <cmath>
#include <condition_variable>
#include <cstdlib>
#include <forward_list>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <mutex>
#include <regex>
#include <set>
#include <string>
#include <thread>
#include <vector>
#include <execinfo.h>
#include <gnu/libc-version.h>
#include <libgen.h>
#include <locale.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/poll.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/sysinfo.h>
#include <unistd.h>
#include <mysql/my_global.h>
#include <mysql/mysql.h>
g++-xc++-E-v-
帮助我找出需要哪些包含路径

顺序很重要


-I/usr/include
必须是列表中的最后一个 G++-C…< /代码>。另外,您的2.27标头正在拾取/usr/include/stdlib.h标头,所以我猜您正在以某种奇怪的方式将两个glibc系统搞砸。很高兴知道。另一个问题是运行时使用了什么动态链接器等。要在可执行文件上运行ldd吗?这可能是偶然的-您当前的libc设置中的动态lnker可能与2兼容。27@SeverinPappadeux我使用了很多rpath指令。没有它就没有办法让它工作。很高兴听到。首先,这是C++程序,请用<代码> G++-C…<代码>编译它。另外,您的2.27标头正在拾取/usr/include/stdlib.h标头,所以我猜您正在以某种奇怪的方式将两个glibc系统搞砸。很高兴知道。另一个问题是运行时使用了什么动态链接器等。要在可执行文件上运行ldd吗?这可能是偶然的-您当前的libc设置中的动态lnker可能与2兼容。27@SeverinPappadeux我使用了很多rpath指令。没有它就没有办法让它工作。很好,很高兴听到。有什么理由下订单吗?通常情况下,这并不重要。你进一步调查了吗?@Carsten是的,我开了一张罚单,但没有人真的想从GNU开发中帮助我。我让它保持原样…有什么理由下订单吗?通常情况下,这并不重要。你进一步调查了吗?@Carsten是的,我开了一张罚单,但没有人真的想从GNU开发中帮助我。我让它保持原样。。。
-nostdinc
-I /FaF/curl/include
-I /usr/include/mysql
-I /FaF/lib64/gcc/x86_64-suse-linux/7.3.0/include-fixed
-I /FaF/include/c++/7.3
-I /FaF/include/c++/7.3/x86_64-suse-linux/
-I /FaF/lib64/gcc/x86_64-suse-linux/7.3.0/include
-I /FaF/glibc/include/
-I /usr/include