Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
gcc的静态编译错误_C_Linux_Gcc_Compiler Errors - Fatal编程技术网

gcc的静态编译错误

gcc的静态编译错误,c,linux,gcc,compiler-errors,C,Linux,Gcc,Compiler Errors,我正在尝试编译以下代码: #include<stdio.h> void func() { printf("In function\n"); return ; } int main() { printf("In mains\n"); func(); return 0; } 我做错什么了吗 我拥有的Gcc版本是Gcc版本4.7.2(Debian 4.7.2-5)看看。如果您有binutils 2.24.51.0.2或更早版本,则可能需要更新以

我正在尝试编译以下代码:

#include<stdio.h>

void func()
{
    printf("In function\n");
    return ;
}

int main()
{
    printf("In mains\n");
    func();
    return 0;
}
我做错什么了吗


我拥有的Gcc版本是
Gcc版本4.7.2(Debian 4.7.2-5)
看看。如果您有
binutils 2.24.51.0.2
或更早版本,则可能需要更新以避免出现带有
\uuuuuuuehdr\u start
符号的错误。具体来说,它看起来像是binutils 2012 0806的更新为ELF文件头添加了对_ehdr_开始符号的支持。然后,在2.24.51的更新中,修复了与uu ehdr_start相关的错误

我在openSuSE上有2.23.2版,没有发现任何问题,在Archlinux上有2.24版,没有发现任何问题。因此,问题似乎与binutils 2012 0806版本和2.24.51版本之间的版本有关


很高兴您解决了这个问题。

编译并运行良好。您是否尝试过谷歌搜索
错误:隐藏符号“\uu ehdr\u start”
您的文件中似乎有垃圾。您运行的是什么操作系统,使用的是什么编辑器?你不是在MS Word中编辑或诸如此类的废话吗?看看。它有一些信息要检查。将你拥有的应用程序的版本与讨论的版本进行比较。我在谷歌上搜索了一下,它与gcc或ld中的一些补丁程序有关。我不能理解整个补丁的事情,所以我在这里问。我使用的是kali linux[Debian fork]。编辑器是vim。如果您有
binutils 2.24.51.0.2
或更早版本,您可能需要更新以获得已应用的修复程序。具体而言,它看起来像是来自binutils 2012 0806的更新为ELF文件头添加了对_ehdr_开始符号的支持。然后在2.24.51的更新中,修复了一个与之相关的bug。我有2.23.2,我没有看到任何问题,我有2.24在另一个盒子上,没有看到问题。
/usr/bin/ld: error: hidden symbol '__ehdr_start' is not defined locally
/usr/bin/ld: error: hidden symbol '__ehdr_start' is not defined locally
/usr/bin/ld: error: hidden symbol '__ehdr_start' is not defined locally
/usr/bin/ld: error: hidden symbol '__ehdr_start' is not defined locally
/usr/bin/ld: error: hidden symbol '__ehdr_start' is not defined locally
collect2: error: ld returned 1 exit status