您的位置:首页 > 编程语言 > C语言/C++

Dev-C++ FAQ

2006-03-10 15:05 274 查看
Dev-C++   FAQ

Click   here   for   Dev-C++   5   FAQ  
Last   update:   27/09/2000

Questions:
1.   When   I   compile   my   dos   program   and   execute   it,   Dev-C++   minimizes   and   then   restore   in   a   second   but   nothing   appears   ?
2.   When   executing   my   dos   program,   it   closes   automatically.   How   I   can   change   this   ?
3.   After   linking,   i   get   the   error   “C:/DEV-C++/LIB//libmingw32.a(main.o)(.text+0x8e):   undefined   reference   to   `WinMain@16'
4.   When   I   launch   Dev-C++   i   get   the   message   saying   “WININET.DLL   not   found”   ?
5.   When   I   compile   a   file,   I   get   a   message   saying   "could   not   find   <filename>   "
6.   The   EXE   files   created   are   huge.   What   can   i   do   to   reduce   the   size   ?
7.   Under   Windows   NT,   every   time   i   launch   Dev-C++   i   get   the   message   “Failed   to   set   data   for”
8.   When   I   try   to   compile   I   get:   ld:   cannot   open   crt2.   o:   No   such   file   or   directory.   What   can   i   do   ?
9.   How   can   i   use   the   OpenGL   library   and   others   ?
10.   When   i   compile   a   file   that   contains   references   to   Windows   filename   (like   </Mydir/myfile.h>),   i   get   a   'unrecognized   escape   sequence'   message   ?
11.   Is   there   any   GUI   library   or   packages   available   for   Dev-C++   ?  
12.   I   am   having   problems   using   Borland   specific   functions   such   as   clrscr()  
13.   The   toolbars   icons   are   showing   incorrectly.
14.   It   seems   i've   found   a   problem/bug   that   is   not   specified   here.   What   should   i   do   ?
15.   When   attempting   to   create   a   setup   program,   i   get   the   error   "File   Bin/Setup.exe   not   found".
16.   How   to   use   assembly   (ASM)   with   Dev-C++   ?

 
Answers:
1.   When   I   compile   my   dos   program   and   execute   it,   Dev-C++   minimizes   and   then   restore   in   a   second   but   nothing   appears   ?

When   creating   a   console   application,   be   sure   to   uncheck   “Do   not   create   a   console”   in   Project   Options   (when   working   with   source   files   only   uncheck   “Create   for   win32”   in   Compiler   Options).

2.   When   executing   my   dos   program,   it   closes   automatically.   How   I   can   change   this   ?

You   can   use   an   input   function   at   the   end   of   you   source,   like   the   following   example   :

#include   <stdlib.h>
int   main()
{
system(“PAUSE”);
return   0;
}

3.   After   linking,   i   get   the   error   “C:/DEV-C++/LIB//libmingw32.a(main.o)(.text+0x8e):   undefined   reference   to   `WinMain@16'

You   probably   haven’t   declared   any   main()   function   in   your   program.   Otherwise,   try   recompiling   a   second   time.

 

4.   When   I   launch   Dev-C++   i   get   the   message   saying   “WININET.DLL   not   found”   ?

If   you   are   missing   WININET.DLL   on   your   Windows   system,   you   can   download   it   at:   http://www.rocketdownload.com/supfiles.htm
 

5.   When   I   compile   a   file,   I   get   a   message   saying   "could   not   find   <filename>   "

Check   in   Compiler   options   if   the   direcories   settings   are   correct.   With   a   default   setup,   you   should   have   :

C:/DEV-C++/Bin/
c:/DEV-C++/Include/
c:/DEV-C++/Include/
c:/DEV-C++/Lib/

 

6.   The   EXE   files   created   are   huge.   What   can   i   do   to   reduce   the   size   ?

If   you   want   to   reduce   your   exe   file   size   from   330   Ko   to   12   Ko   for   example,   go   to   compiler   options.   Then   click   on   the   Linker   page   and   uncheck   "Generate   debug   information".   This   will   remove   debugging   information   (if   you   want   to   debug,   uncheck   it).   You   can   also   click   on   Optimization   page   and   check   "Best   optimization".

 

7.   Under   Windows   NT,   every   time   i   launch   Dev-C++   i   get   the   message   “Failed   to   set   data   for”

The   is   because   you   are   not   in   Administrator   mode,   and   Dev-C++   tries   to   write   to   the   registry.   To   get   rid   of   the   error   message,   log   on   as   the   Administrator,   or   uncheck   the   file   association   options   in   Environment   options,   Misc.   Sheet.

 

8.   when   I   try   to   compile   I   get:   ld:   cannot   open   crt2.   o:   No   such   file   or   directory.   What   can   i   do   ?

Go   to   Compiler   options,   and   check   if   the   Lib   directory   is   correctly   set   to:
C:/Dev-C++/Lib/
(for   a   default   installation).

If   this   still   doesn't   work,   try   copying   the   file   Lib/crt2.o   to   your   Dev-C++'s   Bin   directory.

 

9.   How   can   i   use   the   OpenGL   library   and   others   ?

All   the   libraries   that   comes   with   Mingw   reside   in   the   Lib   directory.   They   are   all   named   in   the   following   way:   lib*.a
To   link   a   library   with   your   project,   just   add   in   Project   options,   Further   option   files   :
-lopengl32
This   is   for   including   the   libopengl32.a   library.   To   add   any   other   library,   just   follow   the   same   syntax:  
Type   -l   (L   in   lowercase)   plus   the   base   name   of   the   library   (filename   without   "lib"   and   the   ".a"   extension).

 

10.   When   i   compile   a   file   that   contains   references   to   Windows   filename   (like   </Mydir/myfile.h>),   i   get   a   'unrecognized   escape   sequence'   message   ?

The   Mingw   compiler   understands   paths   in   the   Unix   style   (/mydir/myfile.h).   Try   replacing   the   /   in   the   filename   by   /  

 

11.   Is   there   any   GUI   library   or   packages   available   for   Dev-C++   ?  

You   can   download   extra   packages   for   Dev-C++   at   http://www.bloodshed.net/dev/
 

12.   I   am   having   problems   using   Borland   specific   functions   such   as   clrscr()  

Include   conio.h   to   your   source,   and   add   C:/Dev-C++/Lib/conio.o   to   "Further   Object   Files"   in   Project   Options   (where   C:/Dev-C++   is   where   you   installed   Dev-C++)

 

13.   The   toolbars   icons   are   showing   incorrectly.

On   some   screen   resolutions,   toolbars   icons   may   show   up   incorrectly.   You   should   try   changing   your   screen   resolution,   or   disable   toolbars   from   the   View   menu   in   Dev-C++

 

14.   It   seems   i've   found   a   problem/bug   that   is   not   specified   here.   What   should   i   do   ?

First,   you   should   try   doing   a   "Check   for   Dev-C++   update"   (in   Help   menu)   to   know   if   a   new   version   has   come   that   may   correct   this   problem.   If   there   are   no   new   version   or   the   problem   wasn't   fixed   then   please   send   an   email   describing   the   bug   to   :   webmaster@bloodshed.net

 

15.   When   attempting   to   create   a   setup   program,   i   get   the   error   "File   Bin/Setup.exe   not   found".

If   you   are   willing   to   use   the   Setup   Creator   feature   of   Dev-C++,   you   need   to   download   and   install   this   file

 

16.   How   to   use   assembly   with   Dev-C++   ?

The   assembler   uses   AT&T   (not   Intel).   Here's   an   example   of   such   a   syntax   :

//   2   global   variables

int   AdrIO   ;
static   char   ValIO   ;

void   MyFunction(..........)  
{
__asm("mov   %dx,_AdrIO")   ;   //   loading   16   bits   register
__asm("mov   %al,_ValIO")   ;   //   loading   8   bits   register

/*
Don't   forget   the   underscore   _   before   each   global   variable   names   !
*/
__asm("mov   %dx,%ax")   ;   //   AX   -->   DX
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息