c - 在 Linux Mint 中编译 C 程序时出错

标签 c ubuntu gcc ld

我在编译一个简单的 C 程序时遇到错误。

#include<stdio.h>
void main()
{
      int i=5;
printf("I value is %d",i);
}

错误是..

/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status

我的 gcc 版本是..

gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.

谁能知道我的问题是什么?

最佳答案

按照下面的教程,建议按照以下方式将路径/usr/bin 插入到环境变量中。

export PATH="/usr/bin:$PATH".

https://askubuntu.com/questions/347466/configure-error-c-compiler-cannot-create-executables

这对我有用。

关于c - 在 Linux Mint 中编译 C 程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16432945/

相关文章:

你还能用旧方法在 C 中使用可变参数吗?

c - 在编辑器中为长(JSON)字符串插入非打印的新行,并使用 printf 给出它(没有新行)

python - 在 digitalocean Ubuntu 16.04 中安装新版本的 Python 后无法运行 Django 控制台

c++ - 地址清理器不适用于 Windows 上的 bash

ubuntu - 为什么这个内置类型在编译时会出错?

c - 找不到 C 中的 getrandom 系统调用

连接4 检查玩家是否获胜

c - 构建交叉编译器 - 错误 : libmpfr not found

c++ - 未定义对 `__stack_chk_fail' 的引用

c++ - 如果将某个符号的名称用作 STL 容器的元素,为什么我不能隐藏它?