编程论坛's Archiver

unicornz2008 发表于 2007-6-17 19:55

急,求高人指点,tc可运行,但borland c 3.1出错!

<P>求高人指点,谢谢<BR>程序tc下可以正常运行,但到了borland c 3.1下面<BR>编译没有问题,make 就出很多链接错误<BR>Linker Error:undefined symbol _initgraph in module ERROR.C<BR>Linker Error:undefined symbol _ cleardevice in module ERROR.C<BR>Linker Error:undefined symbol _ line in module ERROR.C<BR>Linker Error:undefined symbol _moveto in module ERROR.C<BR>...<BR><BR>程序很简单<BR><BR>#include &lt;graphics.h&gt;<BR>#include &lt;stdio.h&gt;<BR>#include &lt;conio.h&gt;<BR><BR>void main()<BR>{<BR>     int gdriver=DETECT,gmode;<BR>     initgraph(&amp;gdriver,&amp;gmode,"C:\\BC45\BGI");<BR>     cleardevice();<BR>     moveto(300,35);<BR>     printf("ATM");<BR>     line(80,60,560,60);<BR>     line(560,60,560,420);<BR>     line(560,420,80,420);<BR>     line(80,420,80,60);</P>
<P>     moveto(190,80);<BR>     outtext("Welcome to use ATM service!");</P>
<P>     setbkcolor(1);<BR>     getch();<BR>     closegraph();<BR>}<BR></P>

neverTheSame 发表于 2007-6-18 00:06

borland c 3.1<BR>没有initgraph(),cleardevice(),moveto(),line()...这样的库函数.<BR>

ba_wang_mao 发表于 2007-6-18 08:37

呵呵,在Turboc ++ 、borland C++ 下系统默认不加载图形库,如下步骤即可:<BR> [Options]---&gt;[Linker]---&gt;[Libraries...]<BR> 在弹出的对话框中,Graphics library 前面打勾即可编译通过。

一笔苍穹 发表于 2007-6-18 08:55

BC的IDE并没有将graphics.lib设置为默认链接<BR>你必要手动设置一下:<BR>Options -&gt; Linker -&gt; Libraries...<BR>将"Libraries"标签下的"[ ]Graphics library"前面的选框"[ ]"勾上,即变成"[X]"<BR>然后再编译试试吧。

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.