linux 交叉编译 静态库,从Linux为Windows开发交叉编译静态库
我想在Linux中為Windows編譯靜態(tài)庫。以下是我跟著編譯從Linux為Windows開發(fā)交叉編譯靜態(tài)庫
使用i586-mingw32msvc-cc -c static_lib.c -o static_lib.o
創(chuàng)建靜態(tài)庫在linux ar rv static_lib.a static_lib.o和ranlib static_lib.a
編譯的Linux靜態(tài)庫的源代碼的程序我在Eclipse中創(chuàng)建了一個示例程序在Windows和鏈接這個靜態(tài)庫,它是在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();
}
請給我點(diǎn)建議編譯并得到它的工作。
問候 杜琪峰艾倫
2011-01-07
Johnnie
總結(jié)
以上是生活随笔為你收集整理的linux 交叉编译 静态库,从Linux为Windows开发交叉编译静态库的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux neo4j 服务器,如何在l
- 下一篇: linux重定向文件不存在,shell