C新手:gcc命令,高分

ml_dark 2011-03-29 05:31:23
gcc -Wall -shared bitmapVSystem.c -o bitmapVSytem.dll
ld: -shared not supported

我想编译成DLL,但是始终报-shared not supported,是怎么回事。。。。。

操作系统:windows xp

===
希望抽支烟回来后答案就来了。。
...全文
319 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
bluesky12312388 2011-04-01
  • 打赏
  • 举报
回复
可能是你的Gcc版本太低了,升级在看看。
SophiaNM 2011-04-01
  • 打赏
  • 举报
回复
windows下 用的是MinGW。
我的V3.2.3没有问题。
luxihua 2011-03-30
  • 打赏
  • 举报
回复
看手册吧,这个比较准确。
luxihua 2011-03-30
  • 打赏
  • 举报
回复
原来gcc也可以在win下用,真的孤陋寡闻了,
xlfm_cadn 2011-03-30
  • 打赏
  • 举报
回复
-shared Produce a shared object which can then be linked with other objects to form
an executable. Not all systems support this option. For predictable results,
you must also specify the same set of options that were used to generate code
(‘-fpic’, ‘-fPIC’, or model suboptions) when you specify this option.
看看你的ld的手册里有没有这个的支持
Soulic 2011-03-30
  • 打赏
  • 举报
回复
试试用-G选项代替-shared
Soulic 2011-03-30
  • 打赏
  • 举报
回复
你用gcc --help看看有没有-shared
masmaster 2011-03-30
  • 打赏
  • 举报
回复
装个cygwin试一试
ml_dark 2011-03-30
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 denuin 的回复:]
试试下面:
gcc -c bitmapVSystem.c
gcc -Wall -shared bitmapVSystem.o -o bitmapVSytem.dll
[/Quote]
这个命令也不行。。
C:\Program Files\C-Free 4\samples>gcc
Using builtin specs.
gcc version 2.95.2 19991024 (release)
xunxun 2011-03-30
  • 打赏
  • 举报
回复
只能说lz的gcc版本太低了,不支持shared编译……
晚秋 2011-03-30
  • 打赏
  • 举报
回复
linux下静态库文件扩展名为.a
# ar cr libmyhello.a hello.o
动态库文件扩展名为.so。
# gcc -shared -fPCI -o libmyhello.so hello.o


MS下静态库扩展名是lib
动态库扩展名是dll
这个编译工具都自动生成了
晚秋 2011-03-30
  • 打赏
  • 举报
回复
gcc 能生成真正的dll吗?
虽然说gcc生成的最终文件是二进制文件
只是填了个文件后缀名而已 随便叫点什么都行 .sdas
YEZI329883153 2011-03-30
  • 打赏
  • 举报
回复
XP不是直接用gcc吧,这个太吓人了吧,从来不知道啊.楼主是没有通过虚拟机,直接XP下用gcc的吗,那请问你是如何配置的让gcc在XP下工作的呢.
xuukai 2011-03-30
  • 打赏
  • 举报
回复
gcc 只用过gcc -o
nfer_cn 2011-03-29
  • 打赏
  • 举报
回复
[Quote=引用楼主 ml_dark 的回复:]
操作系统:windows xp
[/Quote]

lz把环境再详细描述描述
这样的话不好分析
Denuin 2011-03-29
  • 打赏
  • 举报
回复
试试下面:
gcc -c bitmapVSystem.c
gcc -Wall -shared bitmapVSystem.o -o bitmapVSytem.dll
nfer_cn 2011-03-29
  • 打赏
  • 举报
回复
gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)
完美通过

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧