PPRuNe Forums - View Single Post - Compiling
Thread: Compiling
View Single Post
Old 15th Jan 2009, 00:17
  #8 (permalink)  
bnt
 
Join Date: Feb 2007
Location: Dublin, Ireland. (No, I just live here.)
Posts: 733
Received 7 Likes on 6 Posts
Caution: I'm not a "real programmer", and I never learned C/C++, but I have compiled code successfully. I've had a look at the Dev-C++ website, and have a fairly good handle on what it is.

First of all: you don't need Dev-C++ at all to simply compile code: it's a development package (code editor etc.), not a compiler. It calls a separate compiler (gcc), which you need to get from somewhere: the website says that a Mingw32 environment (which I don't know) is bundled in the package - and I presume that includes gcc - fine by me if it works.

The website also mentions Cygwin, which I have used before to compile code I've downloaded. Cygwin is a complete UNIX shell for Windows, where you can install the bits you need, including gcc and other compilation programs, pretty easily. (Also great for learning UNIX commands before you try e.g. Linux.)

Whether that's your solution or not depends depends on what you're working with: are you trying to compile a program you wrote, or is it a package of code that you downloaded from somewhere? The reason I ask is that the compilation process is usually controlled by a "Makefile", sometimes with a configuration step before that. If you don't have a Makefile supplied, it looks like Dev-C++ has some way of creating one or helping you do so. In a typical compilation session, you don't actually compile the whole program at once, but lots of code modules which are "linked" to create the final program, and the Makefile automates this process.

If it's a downloaded code package, it should come with instructions in an INSTALL file or README. It might give you a sequence of commands to run, such as the following example:
open a command window, change to code directory
./configure (configuration step - not always required)
make (compiles the code - may take some time)
make install (installs the compiled program)

Configure or Make might stop, complaining that it can't find some library or command, so you have to find and install that bit - the requirements are usually in the code documentation.
Or, if you do it inside Dev-C++, it probably has some configuration dialogs where it asks you where to find the required bits - but the effect is the same. For all that compilation to work, all the required bits need to be findable i.e. the "path" must be set up to point to the various locations: the compilation programs (make, gcc, etc.), standard libraries, and any libraries required by that specific program.

It might just be easier for you to compile the code from the Mingw32 or Cygwin command shell directly, not from inside Dev-C++ - especially if it's a package you downloaded, not created in Dev-C++. And if you're none-the-wiser after all that, well, it's a bit hard to tell just what you need from that question..!

Last edited by bnt; 15th Jan 2009 at 00:52.
bnt is offline