linux 交叉编译 静态库,从Linux为Windows开发交叉编译静态库
我想在Linux中为Windows编译静态库。以下是我跟着编译从Linux为Windows开发交叉编译静态库
使用i586-mingw32msvc-cc -c static_lib.c -o static_lib.o
创建静态库在linux ar rv static_lib.a static_lib.o和ranlib static_lib.a
编译的Linux静态库的源代码的程序我在Eclipse中创建了一个示例程序在Windows和链接这个静态库,它是在linux中为Windows交叉编译的。在windows上使用的编译器是mingw。
在windows eclipse中编译程序的时候,编译器给了我下面的错误。
static_test\static_lib.a: file format not recognized; treating as linker script
\static_test\static_lib.a:1: syntax error
collect2: ld returned 1 exit status
Build error occurred, build is stopped
的代码如下:
static_lib.c
#include
void func(void)
{
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
printf("Hello\n");
}
sample_static.c
#include
extern void func(void);
int main()
{
printf ("Main function\n");
func();
}
请给我点建议编译并得到它的工作。
问候 杜琪峰艾伦
2011-01-07
Johnnie
总结
以上是生活随笔为你收集整理的linux 交叉编译 静态库,从Linux为Windows开发交叉编译静态库的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: linux neo4j 服务器,如何在l
- 下一篇: linux重定向文件不存在,shell