Aditsu's Unofficial Dev-C++ FAQ
Important:
I haven't used Dev-C++ or gone to the related forum for a long time now. Everything below this paragraph is really old information. I would also like to apologize because I've received some comments and suggestions about this FAQ from time to time, but haven't done anything about them. Some of those emails were lost, and some are just sitting there waiting to be reread. I'll try to get to them, but anyway now there is a comment form at the bottom of the page if you have something to contribute. Here goes the FAQ:Before you even think of looking for your problem and answer on this page, please go to http://www.bloodshed.net/dev/devcpp.html and make sure you have the latest version. Currently (16 Oct 2005) the latest full version is 4.9.9.2 (9 MB). Do not install the old Dev-C++ 4 unless you have special reasons to do it.
This FAQ may contain issues that are no longer applicable or have already been solved; I'll remove them later.
Questions:
Top 5:- When I run my console application, the black window flashes a bit then closes automatically
- 2 (some path)\2 unable to run program file
- This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
- [Linker error] undefined reference to (something)
- Why can't I use conio.h functions like clrscr, gotoxy etc?
Installation/uninstallation: Problems working with the IDE:
- How can I see the output of my program?
- The error messages appear truncated
- Dev-C++ doesn't recompile my code although I made modifications
- Where is the resource editor?
- Can I use Dev-C++ with other compilers?
- Does Dev-C++ support workspaces with multiple projects? How do I import Visual C workspaces?
- Dev-C++ uses gcc instead of g++ for linking
- vUpdate doesn't work!
- I see <Err: xxxx> in various places
- Code completion doesn't work well, crashes, kills my cat, etc.
- This IDE is too buggy, I want to use something else
Debugging questions:
- I can't debug, how do I debug?
- Can't evaluate object members
- Console I/O doesn't work while debugging
- The debugger doesn't stop at breakpoints in constructors
- When I debug the program, Dev-C++ keeps opening new windows with the source code
Problems by error message:
- 2 (some path)\2 unable to run program file
- This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
- `cout' undeclared (first use this function)
- [Warning] no newline at end of file
- `main' must return `int'
- [Linker error] undefined reference to `mcount'
- `clrscr' undeclared (first use this function)
- [Linker error] undefined reference to `clrscr'
- [Linker error] undefined reference to `__gxx_personality_v0'
- [Linker error] undefined reference to (something)
- Fatal: 'all-before' does not exist - don't know how to make it
- bits/c++config.h: No such file or directory
- `this' is not an aggregate
- [Warning] unused parameter (something)
Other questions/problems:
- What is Dev-C++?
- Can I make software with Dev-C++ and distribute or sell it without giving away the sources?
- Why is the compiled executable file so large?
- How can I do graphics? Where is graphics.h?
- How can I write inline asm (assembly) code?
- My resource file doesn't work
- I can't find the answer here, what can I do?
- How to ask questions on the forum?
Answers:
When I run my console application, the black window flashes a bit then closes automatically
How can I see the output of my program?
Your program does exactly what you tell it to do, and you didn't ask it to wait before closing.How can I see the output of my program?
You can add a command to wait for keyboard input before the program exits (e.g. before the return from main). A very simple example is
system("pause");
which executes the "pause" system command
(portability note: this only works in Windows and DOS);
you need to #include <cstdlib>
(or #include <stdlib.h>
for C programs)
if the compiler complains about the system
function.Or you can use an instruction that reads something from the keyboard (e.g.
cin.get();
, getchar();
or cin>>variable;
).
In that case you may need to clear the input buffer before reading, e.g. cin.sync();
before cin.get();
.Another option is to run your program from the command prompt; this is especially useful if you don't want it to wait before closing, or if it crashes before it reaches the keyboard-reading instruction.
2 (some path)\2 unable to run program file
Update: this problem should be solved completely in Dev-C++ 4.9.9.2.If you don't want to upgrade, or somehow you still get the error in 4.9.9.2, read on.
This happens when the IDE can't find one of the programs needed for compiling your file/project (usually it is make, gcc or g++).
The most common cause is a nasty BUG in the Dev-C++ installation system: the uninstaller doesn't remove the Dev-C++ configuration files, and the installer doesn't overwrite them. So if you try to install Dev-C++ in a different folder without following these instructions, you will most likely get this error for everything you try to compile.
To solve this, you can try my automatic Dev-C++ maintenance tool, and if it doesn't help (or you prefer doing it manually) then there are two ways you can fix it:
1. The "blind reinstall" solution: uninstall Dev-C++ cleanly (pay special attention to the devcpp.ini and devcpp.cfg files if you have Dev-C++ 4.9.x.x), then reinstall the full latest version (see top of this page) in a folder with no spaces in the path. It should work afterwards.
2. The "smart fix" solution: read the compile log to see which program it tried to run; go to and see what file it is looking for and in which folder (click the "..." button) and check if it is found in that folder. If the specified file is not there, then select it from the Dev-cpp\bin folder (or wherever you installed your compiler).
It might also help to set correctly.
Note: if you downloaded the IDE-only version (~2 MB) and you didn't install a gcc compiler (e.g. the mingw package), then you won't find the necessary programs; refer to solution 1.
This file includes at least one deprecated or antiquated header.
Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard.
Examples include substituting the <X> header for the <X.h> header for C++ includes,
or <sstream> instead of the deprecated header <strstream.h>.
To disable this warning use -Wno-deprecated.
First, this is a warning, not an error.Second, just do what the message says (isn't that painfully obvious?!?)
Change iostream.h to iostream, strstream.h to sstream, etc.
I know they told you it should be "iostream.h", I know it worked with every single compiler you used before (including gcc 2.95), but it doesn't exist in the C++ standard, so if you want to write correctly in C++ then you must forget this "tradition" and learn to use the new headers and the std namespace.
Here is more information.
[Linker error] undefined reference to (something)
Cause: You usually get a linker error (undefined reference) when you try to use a
function which was declared but not defined.By including the header file, you usualy get only the declaration of the function, but not its definition (that is, function body).
Solution: you can get the definition of a function through several ways:
- defining the function yourself in the same or another cpp file (or adding to the project a cpp file which includes the definition)
- linking an object file (a compiled source file) which includes that function definition
- linking a library (which is a collection of object files) which includes that function definition; this is the most frequent case
Note: linking order is important, especially for libraries; if file A references symbols defined in file B, then link first A then B!
Explanation: You might be confused because you used some functions successfully without doing any of the above; that happened because the compiler automatically links some standard libraries for you. If your function is defined in a non-standard library, then the compiler won't link it unless you tell it to, even if it knows where to find it.
By the way, if you "wipe clean" the linker configuration so that nothing will be linked automatically, then you'll notice the same kind of error with, for example, printf.
Note: if you use g++ for linking, it will link some additional C++ libraries (compared to gcc) if they are needed. If you have a project with C++ sources and link it with gcc, you may get undefined references; see the answer about linking with g++ vs gcc.
How to link: Generally, for all the functions available in the mingw header files, the mingw package provides libraries with the function definitions; not all available libraries are automatically linked, because not all functions are standard C/C++; you just have to link them to your project when you need them.
The library files are called "libname.a" and are located in the Dev-Cpp\lib folder; the easiest way to link them is to add
-lname
(note: no "lib" and no ".a",
and that's a small L not a capital i)
to the linker parameters in your project, that is You can also use the button in that window, and that's ok for object files, but for libraries you may run into problems when you move things to other folders or to another computer.
If you use external libraries (i.e. not included in mingw), then you should either put them in the Dev-Cpp\lib folder, or add the folder which contains the libraries to the list of library dirs, in .
You may still have problems if the libraries you link were compiled with an old version of gcc (and definitely if they were compiled with another compiler). Try to get libraries that match your compiler, or recompile them if you have the source code.
Finding libraries: Which library do you need to link? Usually, the library name is similar to the name of the header file that declares the functions, e.g. wingdi.h -> libgdi32.a, winsock2.h -> libws2_32.a; if you can't find it then just do a file search using Windows Explorer (search for library files (lib*.a) containing the function name).
Note: Microsoft managed to totally BOTCH the search functionality in Windows XP. You may want to use a file manager such as Total Commander, or see this article.
`clrscr' undeclared (first use this function)
[Linker error] undefined reference to `clrscr'
Why can't I use conio.h functions like clrscr, gotoxy etc?
First you should note that conio.h is a Borland extension, NOT a standard header, so Dev-C++
and MinGW are in no way required to support it. The MinGW included with Dev-C++ 4.9.9.1 comes
with a very reduced version of conio.h (no clrscr, gotoxy, etc); if you need more then
you can use the native Windows
console functions.[Linker error] undefined reference to `clrscr'
Why can't I use conio.h functions like clrscr, gotoxy etc?
I also provide and maintain an updated version of conio (and also winbgim) at http://www14.brinkster.com/aditsu/console/; that may be what you are looking for.
How can I install Dev-C++ correctly?
First, if you currently have Dev-C++ 4.9.x.x, you should uninstall it.Then install the latest version (see the top of the page) in a folder with no spaces in the path. This is important, otherwise you risk getting various errors and inconsistencies.
Why? The cause is uncertain: either the unix legacy of the programs in the compiler suite or a Dev-C++ buglet in path handling. But it is certain: spaces in the path ask for trouble.
Examples of good paths: C:\Dev-Cpp, D:\Dev-Cpp, C:\progs\devcpp, F:\aditsu\soft\devcpp4990
Examples of bad paths: C:\Program Files\Dev-Cpp, C:\Dev Cpp, C:\Documents and Settings\aditsu\Desktop\Dev-cpp
How can I uninstall Dev-C++ cleanly?
For Dev-C++ 4.0x or 4.9.9.2, just uninstall it from Control Panel - Add or Remove Programs.For Dev-C++ 4.9.x.x (before 4.9.9.2) you can try my automatic Dev-C++ maintenance tool, or follow these instructions very carefully:
First, run uninstall.exe from the Dev-cpp folder. Delete the Dev-Cpp folder (after backing up any files you want to keep). Then search and delete devcpp.* especially devcpp.cfg and devcpp.ini - on windows 2000 or XP they are normally found in Documents and Settings\username\Local Settings\Application Data, which is a hidden folder. You might have to set up your Windows Explorer to display hidden files/folders, or select to search hidden files/folders too. If you use the Windows XP file search thingie (which, in nice words, sucks ass), then you have to select to search in hidden folders too, or else it won't find them.
The general attitude should be "search, seek and destroy every trace", otherwise you might get problems if you reinstall Dev-C++ afterwards.
The error messages appear truncated
Normally, gcc splits long error messages to several lines, for easy reading, but Dev-C++ will only
read the first line of each message.To force gcc to output messages on a single line, add
-fmessage-length=0
in .In any case, you can see the complete messages in the "Compile Log" tab.
Dev-C++ doesn't recompile my code although I made modifications
By default, Dev-C++ only checks if the c or cpp files in the project were modified, and if they were,
then it recompiles them. It doesn't check if a header file used by those source files was modified or
not. If you want it to check this too, then clear the checkbox and be prepared to wait
a bit longer for the subsequent compilations. Either way, you can always rebuild your entire
project by pressing Ctrl-F11.
Where is the resource editor?
Dev-C++ doesn't have a visual resource editor. If you need to edit resource files (*.rc) then
you can either do it by hand (in the text editor) or download and use a free resource editor.
Some people recommended ResEd.I am currently (i.e. seldom, when I have time and mood) working on a resource editor project. You can get the current version from here.
Alternatively you can use a GUI library/toolkit. Apparently there is no library that satisfies everybody, but the most popular ones are wxWidgets, GTK, FLTK and Fox. MFC and Qt can not be used with MinGW as far as I know.
New: I heard there is a QT for MinGW; I don't know any other details about it so you're on your own.
Can I use Dev-C++ with other compilers?
Dev-C++ was designed to work with gcc only. However, this doesn't really constrain you to
use only one compiler, because gcc can have several flavours: mingw, cygwin, cross-compilers etc,
each of them with different versions.If you want to set up Dev-C++ to use another compiler, you have to configure it in , all tabs. If you can't figure out what to do there, then you probably shouldn't be doing it.
However, you can not use non-gcc compilers such as Borland's bcc. I don't know why you would want to do that, because they have no advantage over gcc (the ones who have are commercial and come with their own IDE). Anyway, remember that Dev-C++ is not a general programmers editor, but an IDE for Windows-based gcc compilers.
Does Dev-C++ support workspaces with multiple projects? How do I import
Visual C workspaces?
Currently Dev-C++ does not support workspaces. You can just open one project at a time in each instance
of the IDE. If you want to import Visual C workspaces, you have to import each project (.dsp file)
separately ( ). Note: that works only with VC 6.0, for
newer versions you have to convert the project files.If you *must* build several projects together, with dependencies and stuff, then your only option is to write your custom makefile to do that... or use another IDE that supports workspaces.
Dev-C++ uses gcc instead of g++ for linking
This happens when your project is a "C project" (you can select that when you create it)
but it contains (or links to) C++ files. To change it to be a C++ project,
close Dev-C++, edit your .dev file with a text editor and set IsCpp=1
in the
[Project]
section, then reopen the project.
vUpdate doesn't work!
Indeed, vUpdate has been discontinued since its author left the team.
You should upgrade your
Dev-C++, the latest versions (see the top of this page) include WebUpdate,
the replacement for vUpdate.
I see <Err: xxxx> in various places
Update: should be fixed in 4.9.9.2.Most likely you upgraded Dev-C++ but you're still using old language files. You need to get the updated language files; use WebUpdate for that. It's also possible that the updated language files are not available for your language - then you can switch to English or fix the language files by yourself and tell somebody about that.
Code completion doesn't work well, crashes, kills my cat, etc.
Code completion in Dev-C++ is quite broken and can't be fixed easily. It works in some cases, but often gets confused.To turn it on/off or configure it, go to .
This IDE is too buggy, I want to use something else
I personally can get along quite well with Dev-C++. If you can't, or just want to try another IDE, take a look at
Code::Blocks. You can also drop me a line to let me know if you love it or hate it :)
I can't debug, how do I debug?
First, make sure you are using a project (you can debug without a project, but
it is more convenient to use a project, and besides, it's the only way I describe here *grin*).Then go to and set to "yes", and make sure you are not using any optimization options (they're not good for debug mode). Also check the tab, make sure you don't have any optimization options (like -O2 or -O3, but -O0 is ok because it means no optimization) or strip option (-s).
After that, do a full rebuild (Ctrl-F11), then set breakpoint(s) where you want the debugger to stop (otherwise it will just run the program). To set a breakpoint on a line, just click on the gutter (the gray band on the left), or press Ctrl-F5.
Now you are ready to launch the debugger, by pressing F8 or clicking the debug button. If everything goes well, the program will start, and then stop at the first breakpoint. Then you can step through the code, entering function calls, by pressing Shift-F7 or the "step into" button, or stepping over the function calls, by pressing F7 or the "next step" button. You can press Ctrl-F7 or the "continue" button to continue execution till the next breakpoint. At any time, you can add or remove breakpoints.
When the program stopped at a breakpoint and you are stepping through the code, you can display the values of various variables in your program by putting your mouse over them, or you can display variables and expressions by pressing F4 or the "add watch" button and typing the expression.
For more information refer to the help included with Dev-C++.
Console I/O doesn't work while debugging
This is a problem with gdb 5.1.1 on Windows 9x/ME. You can solve it by upgrading gdb to version
5.2.1 or later. The full Dev-C++ 4.9.9.1 includes gdb 5.2.1.
The debugger doesn't stop at breakpoints in constructors
Quoting from this page about
gdb 6.0:When gcc 3.x compiles a C++ constructor or C++ destructor, it generates 2 or 3 different versions of the object code. These versions have unique mangled names (they have to, in order for linking to work), but they have identical source code names, which leads to a great deal of confusion. Specifically, if you set a breakpoint in a constructor or a destructor, gdb will put a breakpoint in one of the versions, but your program may execute the other version. This makes it impossible to set breakpoints reliably in constructors or destructors.
gcc 3.x generates these multiple object code functions in order to implement virtual base classes. gcc 2.x generated just one object code function with a hidden parameter, but gcc 3.x conforms to a multi-vendor ABI for C++ which requires multiple object code functions.
gdb 6.0 hopefully fixes this, you can try the snapshot build from the mingw site and tell me if it works.
Update: I heard a report that gdb 6.0 didn't work [well] with Dev-C++, but I didn't confirm it.
When I debug the program, Dev-C++ keeps opening new windows
with the source code
This bug is solved in Dev-C++ 4.9.9.1; please upgrade.
`cout' undeclared (first use this function)
Either you forgot to #include <iostream>
or
you didn't access cout correctly. You might need to update your knowledge of C++.The standard C++ library functions, classes and objects are declared ONLY in the std namespace. Therefore, you must use one of these 3 methods to access them:
1. add
using namespace std;
after your #include
s (this is recommended
for small or simple programs)2. add
using std::ident;
after your #include
s, for each
identifier you want to use3. use
std::ident
everywhere in your code (this is recommended for header
files)
[Warning] no newline at end of file
Update: fixed in 4.9.9.2!This is a warning, not an error. C and C++ source files are required (by the standard) to end with an empty line. Older versions of Dev-C++ automatically (and secretly) added it for you; 4.9.9.1 doesn't do that anymore.
So just open the file in question, go to the end and add a new and *empty* line (no spaces and no tabs).
`main' must return `int'
Yes that's right, you have to write int main
!No matter what your teacher, lecturer, parent, brother, neighbor, friend, xyz C/C++ manual or web site has told you, and no matter how many compilers accept it, "void main" always was, is and will be wrong!
main
MUST return int
, both in C and C++!Don't believe me? Then read what the creator of C++ has to say about it!
The fact is:
main
can take any parameters, but must always return int. Usually you will use either
int main()
(which is IDENTICAL to int main(void)
) or something like
int main(int argc, char**argv)
for getting command-line parameters (char*argv[]
also works well). Note that, at least for gcc/g++, main
is always a C function (even in C++ programs)
so you can't overload it.Also, in C you must return a value from
main
(an int). In C++ you can skip writing a return
instruction at the end of main
, it defaults to return 0;
, but if you have a
return
then you must return an int.Finally, do *NOT* call main recursively! It's generally very bad, and in C++ it's forbidden by the standard. Most people who do that need to use a loop instead.
[Linker error] undefined reference to `mcount'
If you need code profiling, add -pg
to .If you don't need code profiling, disable it in .
[Linker error] undefined reference to `__gxx_personality_v0'
This usually happens when you are linking a C++ project with gcc, but
sometimes it is also caused by linking (with g++) object files which were compiled with different
compiler versions. In that case, the solution is to recompile the code (or get updated libraries
if you don't have the source).
Fatal: 'all-before' does not exist - don't know how to make it
Update: should be fixed in 4.9.9.2.That happens when the wrong make.exe is invoked, usually the Borland one. It is easy to notice if it leaves a copyright notice in your compile log.
To solve it, you can try my automatic Dev-C++ maintenance tool; if it doesn't help (or you prefer doing it manually) then try these things:
- take a look at the unable to run program file error and follow the (manual) instructions
- add the bin folder of your Dev-C++ (or MinGW) installation to the PATH environment variable, before any Borland path that might be there
- rename make.exe from the bin folder to mingw32-make.exe (if you already have it, just delete the make.exe) and set it accordingly in
bits/c++config.h: No such file or directory
This shows that you have an old or bad installation (probably from Dev-C++ 4.9.7.0). You can fix the
problem by adding DevCppPath\include\C++\mingw32
to , where DevCppPath is the folder where
you installed Dev-C++, e.g. C:\Dev-Cpp.
Can't evaluate object members
`this' is not an aggregate
It should work in Dev-C++ 4.9.9.1; if you still have problems, try watching
`this' is not an aggregate
*(classname*)this
instead, and it will hopefully show you all the object members.
[Warning] unused parameter (something)
This is a warning, you declared a parameter in a function, and never used it.
You can remove it, or if you have to keep it then delete its name (keep the type only) but this works
only in C++.
What is Dev-C++?
This is not actually a frequently asked question, but rather a question to which a wrong answer is
frequently assumed.Dev-C++ is NOT a compiler! It is an IDE (Integrated Development Environment), which mainly means that it has a programming-oriented editor, a project manager, and visual interfaces to various external programs.
These programs are mingw builds of GNU tools, specifically: gcc and g++ for compiling and linking, make for building projects, gdb for debugging, and others. So when a problem occurs with one of these actions, it is usually either related to the respective mingw tool, or to the interface between Dev-C++ and it.
Can I make software with Dev-C++ and distribute or sell it without
giving away the sources?
(Contributed by Mathias Bierschenk)First of all, the following answer is *solely* based on my opinions. I'm *not* a lawyer and the information I provide here may be outdated, misleading, or simply wrong. If you need legal advice please consult a lawyer. That said, I appreciate any corrections or other kind of feedback.
As you might know, the Bloodshed Dev-C++ IDE is licensed under the terms of the GPL (GNU General Public License). When people read the GPL they often fear that the programs generated with Dev-C++ will also have to be released under the GPL, thus making it practically impossible to distribute them as shareware/commercial (non-free) software. This assumption is reasonable, but for the most part false.
The GPL [1] basically says: If you modify a GPL program, or if you include parts of a GPL program into another one, then the resulting program must be released (if at all) under the GPL as well. That means, if you get the "Bloodshed Dev-C++" sources and improve them then you may *not* distribute or sell the resulting super software development environment without making the updated sources available freely.
But the GPL does *not* place any restrictions on just *using* a GPL program. Before we get into the details you should notice that the full Dev-C++ package is not a single program, but a collection of several tools, such as compiler, linker, libraries, header files, editor...
Consider the work of the compiler. It takes a source file, let's say in C or C++. It "processes" this file in some ways and then it generates a certain output (an object file). While the compiler works we neither modify the compiler nor does the compiler put parts of itself into the resulting object file. It just *translates* our C/C++ sources into machine language, without adding anything. [2].
The same for the editor. If you type in some source code you get a C or CPP file but that file won't include any part of the editor itself.
When you think about what goes on internally when you develop software you will notice that there is only one step when some code of a development tool is included into your program: the libraries while linking. Notice that no part of the linker will be included into your program, but the libraries themselves.
So under which license terms are the Dev-C++ libraries released?
Dev-C++ by default uses the MinGW libraries. Fortunately, one of the goals of the MinGW project was to "avoid the encumbrances of the GPL". Several parts of the MinGW libraries are licensed under different terms, but almost all of them don't place any restrictions upon your code if you just *use* them (the only exception is if you use profiling code, but you won't sell software with such code anyway). If you modify the libraries, however, there *might* be restrictions, but I leave this for you to find out. [3]
Summary:
- If you just *use* Bloodshed Dev-C++ (instead of modifying it) the whole legal issue is about the libraries.
- If you use the default MinGW libraries then there aren't any restrictions (except for profiling code).
- If, for whatever reason, you use another set of libraries instead of the MinGW ones or if you use any additional libraries or source code, then you have to read the license terms that apply to them. In particular, GPL libraries impose the GPL on the programs that link to them.
References:
[1] The GPL itself (also part of the Bloodshed Dev-C++ package)
[2] Some frequently asked questions about the GPL, answered by the Free Software Foundation (the inventors of the GPL). Please notice in particular the following:
- Can I use GPL Tools for non-free programs?
- Can the GPL apply to the output of a program?
[3] MinGW license information to get the details.
Why is the compiled executable file so large?
People usually ask this question when they compile a simple program which uses iostreams.
The first thing you can do is to add -s
to , but the result may be still too large for your taste. In this case, either try to
live with it (it actually doesn't matter so much!), or avoid iostreams (use cstdio), or use
another compiler. Also note that there are some exe compressors on the net, e.g.
upx.The reason why iostream increases the size so much is that the linker links entire object files (from inside of libraries) if they contain at least one necessary reference, and the library for iostream is not well separated into small object files. Also, the linker should be able to link only certain sections of the object files (see "--gc-sections"), but this particular feature doesn't work yet on the mingw target (and that affects all libraries and object files).
How can I do graphics? Where is graphics.h?
First you should note that graphics.h is a Borland extension, NOT a standard header, so Dev-C++
and MinGW are in no way required to support it.There are many ways to do graphics in Windows: API functions (GDI), DirectX, OpenGL, third party libraries etc.
If you need to do graphics.h-style graphics, you can use the winbgim library which tries to keep the compatibility with the Borland functions; you can find it on the web, or in the CLGDI devpak.
I also provide and maintain an updated version of winbgim (and also conio) at http://www14.brinkster.com/aditsu/console/; that will probably solve some problems, including some conflicts between conio and winbgim.
How can I write inline asm (assembly) code?
The gcc syntax for asm is different from other compilers; an asm instruction looks like this:asm("statements" : outputs : inputs : clobbers);
where the colon parts are optional.
The default syntax for the actual statements is AT&T, which is quite different from the well-known Intel syntax. However, you can switch to the Intel syntax by adding
-masm=intel
to the
compiler options.Here are some documentation pages: the official gcc extended asm docs, a gcc inline asm tutorial and a guide to inline assembly for gcc/djgpp. They all use AT&T syntax.
Important: you can not normally use interrupts and ports as you did in DOS; especially the NT-based systems (including Windows XP) deny direct access to hardware and require you to use some API functions instead.
My resource file doesn't work
There are several kinds of problems related to resource files. Take the following steps:1. make sure you added the resource file to the project (together with your c/cpp files); if you're not using a project then you have to create one
2. go to , click your resource file and select
3. delete the projectname_private.* files, they will be automatically generated again
4. do a full rebuild
If you still have errors after these steps, then the problem must be inside your resource file and/or in your code. If you have an error in the "Resources" tab then it's clearly the resource file. If the file was written for another compiler (usually Visual C), then take these steps:
1. remove everything that has "afx" in it
2. add
#include <windows.h>
at the beginning of the file3. add
#define IDC_STATIC -1
after that4. make sure that you
#include
any header that has #define
s used in the
resource fileIf it still doesn't work, then you may need to ask in the forum.
I can't find the answer here, what can I do?
First take a look at the other FAQs available for Dev-C++:- Official Dev-C++ 5 FAQ
- Bloodshed Software Forum FAQ
- Official Dev-C++ 4 FAQ (this one is old)
If you have a general C++ question, check the C++ FAQ lite.
If you still can't find the answer, then follow these steps:
1. use Google
2. go to the Bloodshed Software Forum and first read the forum FAQ (also mentioned above) which is kindly maintained by Wayne.
3. search the forum (todo: I can't figure out how)
4. if you tried everything and haven't got an answer, then ask your question in the forum
How to ask questions on the forum?
Any moron can blurt out a question, but you should consider some things if you plan to get a
satisfactory answer quickly.
First make sure you followed the previous steps. Then take a look at these
guidelines if you haven't seen them before. Some of them are also
mentioned in the forum FAQ. The main points should be:- make it short but include all the necessary information (e.g. OS version, Dev-C++ version, compile log (right-click to copy), short source code example); people don't come to the forum to read novels or to play 20-questions and read your mind
- use a meaningful subject
- show that you tried other means to find the answer
- don't rush to claim that you found a bug or that something is wrong; it's safest to assume you made a mistake
- try to use correct logic, grammar and spelling (non-native speakers are partly excused but should still try their best), be polite, don't TYPE IN ALL CAPS and don't try to show what a l33t h4X0r you are
- don't ask people to do your homework, and don't label your problem as urgent: it will probably have opposite effects
- don't ask to get a reply by e-mail
- if you solved the problem then describe the solution briefly, it can help others a lot
And as a final note: it would be very nice if you mention your name at the end of the message (can be a nickname). People want to know who they're talking to.
In case you missed it, the address of the forum is http://sourceforge.net/forum/forum.php?forum_id=48211 (works with https too)
Contact info and permitted use:
If you want to add something to this FAQ list, or if you found an error, or just have a comment for me, then please use the comment form at the bottom of the page, or email me at aditsu@yahoo.com, but do NOT email me for asking questions. For that, use the steps described above.You are welcome to link to this FAQ (http://www.aditsu.net/Dev-cpp_FAQ) from any page, and you can also copy it to your site if you don't modify the contents (you can still do whatever you want with the CSS styles). Especially you must keep the above link to the original page.
Alternately, you can modify the contents but then you should remove any reference to me (except mentioning that you used parts of my FAQ).