小编eez*_*eet的帖子

无法使用clang交叉编译到SPARC

所以情况就是这样:我需要能够从Linux机器(在Ubuntu上,它的价值)编译二进制文件,它们能够从SPARC服务器运行.我正在尝试编译的程序非常简单:

#include <stdio.h>
#include <stdlib.h>

int main() {
    printf("Testing the SPARC program...");
    return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试了许多不同的编译行来使它工作,但不幸的是似乎没有任何工作.

我试过传统的:

 clang -target sparc blah.c -o blahsparc
Run Code Online (Sandbox Code Playgroud)

但这不起作用,有一堆汇编程序失败:

 /tmp/blah-519e77.s: Assembler messages:
 /tmp/blah-519e77.s:7: Error: unknown pseudo-op: '.register'
 /tmp/blah-519e77.s:8: Error: unknown pseudo-op: '.register'
 /tmp/blah-519e77.s:9: Error: unknown pseudo-op: '.register'
 /tmp/blah-519e77.s:10: Error: unknown pseudo-op: '.register'
 /tmp/blah-519e77.s:11: Error: no such instruction: 'save %sp,-240,%sp'
 /tmp/blah-519e77.s:12: Error: no such instruction: 'st %g0, [%fp+2043]'
 ...
 clang: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我也试过这个: …

c c++ sparc clang llvm-clang

7
推荐指数
1
解决办法
1506
查看次数

std :: unordered_map抛出未处理的异常

我有一个std :: unordered_map作为结构类型的全局变量的一部分:

typedef struct level_locals_s {
    std::unordered_map<std::string, std::string> spawnVars;
    ...
} level_locals_t;

level_locals_t level;


...

...


void AddSpawnFields( char *key, char *value ) {
    level.spawnVars.insert(std::make_pair<std::string, std::string>(key, value);
}
Run Code Online (Sandbox Code Playgroud)

程序在插入时崩溃.我检查了,键/值是正确的.这是它崩溃的地方:

iterator begin()
{   // return iterator for beginning of mutable sequence
    return (iterator(this->_Nextnode(this->_Myhead), this));
}
Run Code Online (Sandbox Code Playgroud)

这个 - > _ Myhead似乎是NULL.这是什么原因?

使用Microsoft Visual C++ 2010. 0xC0000005:访问冲突读取位置0x00000000是错误.

编辑:这是一个可编辑的例子:

#include <stdio.h>
#include <string>
#include <unordered_map>

using namespace std;

typedef struct level_locals_s
{
    unordered_map<string, string> spawnArgs;
} level_locals_t;

level_locals_t level;

void main(char **args, int …
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
1174
查看次数

标签 统计

c++ ×2

c ×1

clang ×1

llvm-clang ×1

sparc ×1