【问题标题】:gcc throwing error relocation truncated to fit: R_X86_64_32 against `.bss'gcc 抛出错误重定位被截断以适应:R_X86_64_32 针对 `.bss'
【发布时间】:2016-07-15 19:02:28
【问题描述】:
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
int dp[100000][100000];
int main()
{
    long int n;
    cin>>n;
    vector <int> a(n);
    for(long int i=0;i<n;i++)
        cin>>a[i];
    memset(dp,0,sizeof(dp));
    long long int maxi=0;
    for(long int i=0;i<n;i++)
    {
        for(long int j=i;j<n;j++)
        {
            dp[i][j]=dp[i][j-1]^a[j];
             dp[i][j]%=mod;
             if(maxi<dp[i][j])
                 maxi=dp[i][j];
        }
    }
    cout<<maxi;
    return 0;
}       

编译器抛出错误: 在函数_GLOBAL__sub_I_dp': (.text.startup+0x185): relocation truncated to fit: R_X86_64_32 against.bss' (.text.startup+0x194):重定位被截断以适应:R_X86_64_32 对 `.bss' 错误:ld 返回 1 个退出状态 这是什么错误?

【问题讨论】:

    标签: c++


    【解决方案1】:

    您的全局数组占用 40GB;你不能把它放在程序的.data 部分。它不适合那里。

    即使是这样,你最终也会得到一个巨大的二进制文件,所以这首先是个坏主意。

    如果您安装了 45+GB RAM,您可以为此使用动态分配(通过std::vector),否则,重新考虑您的代码需要更少的内存。

    【讨论】:

      猜你喜欢
      • 2014-08-13
      • 1970-01-01
      • 2018-04-06
      • 2019-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-25
      相关资源
      最近更新 更多