日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux 交叉编译 静态库,从Linux为Windows开发交叉编译静态库

發(fā)布時間:2025/3/15 linux 13 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux 交叉编译 静态库,从Linux为Windows开发交叉编译静态库 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

我想在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)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。