我正在尝试为MIPS系统(路由器)构建一个交叉编译器,但遇到了一些问题。到目前为止,我已经尝试了builtroot和crosstool ng,但没有成功,所以我想确保我这样做是正确的。
我的测试代码(hello.c)编译成功,但在目标上失败,出现以下错误:
Syntax error: "(" unexpected
系统信息-->
cat version
Linux version 2.6.31 (june.lin@dnixm-compiler3) (gcc version 4.3.3 (GCC) ) #1 The Dec 18 16:24:21
cat cpuinfo
我尝试调试此
并得到错误
not in executable format: file format not recognized
'file‘命令输出
canary: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked,
interpreter /lib/ld-linux.so.2, BuildID[sha1]=377711637c79e57303ff92f946500aed1b42c73a, for
GNU/Linux 3.2.0, not stripped`
另一个答案似乎对
在我的Arch机器上,我安装了Mono C#编译器5.20.1.0版本。今天,我在C#中创建了一个简单的hello world程序,如下所示:
using System;
public class Program
{
public static int Main()
{
Console.WriteLine("Hello world of C# !");
Console.WriteLine();
return 0;
}
}
我去了bash终端,并将上面的程序编译为
$ mcs t.cs
这在工作目录
当您有多个C文件时,比如说main.c和process.c,我试图了解在这两种情况下,函数之外声明的变量存储在哪里。
// this is main.c
#include <stdio.h>
#include "process.h"
int foo = 1;
void main() {
int count = get_counter();
}
// this is process.c
#include <stdio.h>
int counter = 0;
int get_counter() {
return counter;
{
因
大多数时候,当你编译一个共享库时,执行它是没有意义的,这样做也不会产生任何有用的东西:
$ ./libfoobarbaz.so
Segmentation fault
然而,当glibc被执行时,GNU的人已经能够坚持一些输出:
$ /lib/libc.so.6
GNU C Library (Debian EGLIBC 2.11.2-10) stable release version 2.11.2, by Roland McGrath et al.
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software;