Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » DevCpp project files

This thread is locked; no one can reply to it. rss feed Print
DevCpp project files
MindCode
Member #2,031
March 2002
avatar

My project has become complex enough that it requires many separate source files to be compiled and linked together. I know that I can add source files to the project, but does DevC++ automatically link their object files together when it's compiled with Gcc? I've also had troubles with include files. Several of the source files include the same headers, and when I build them (with the above assumption about linking), the compiler barfs out "multiple declaration" errors. Is their any suggestions around this?

______________________________________
Frag The Planet

Surt
Member #273
April 2000
avatar

Dev-C++ will link all objects created from project files.

Encapsulate the contents of your headers with:

#ifndef HEADER_ID__
#define HEADER_ID__

// content here

#endif

To prevent redefinition.

---
--
-

MindCode
Member #2,031
March 2002
avatar

The thing that's confusing me is that I have done that. Each header has it's own definition for preventing that, but it still barfs these errors. I really don't get it.

______________________________________
Frag The Planet

Surt
Member #273
April 2000
avatar

Are you sure you've gotten every header? Are you sure the HEADER_ID__ is being defined?

Give us the error messages so that we may interperet them for ourselves.

---
--
-

MindCode
Member #2,031
March 2002
avatar

Oh darnit I'm a moron. I haven't checked this yet, but I know what happened. What I was doing before was "#include"'ing the .cpp files rather than compile+link them (I know it sounds dumb), and I forgot to delete those include statements so the .cpp files were essentially begin compiled and linked twice.

______________________________________
Frag The Planet

Johan Halmén
Member #1,550
September 2001

Other IDEs have one button for compiling and another for making. When compiling, only the active source file gets compile, not linked. When making, all files are compiled and linked. This is a convenient way to check the syntax on one file. (I know, another is to write good code in the first place:P) Dev-C++ has only this compile command that performs a total make of the whole project, which is time consuming.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Cage
Member #1,277
March 2001

The new versions of Dev-C++ use makefiles and your choice of fast/inaccurate or slow/accurate dependency generation, so only the most recently changed files get recompiled.

-----
"I'm dumb!. it prolly wont do anything just like Sub7 when u extract it to ur own system I'm dumb!." - theforgotten
"heh i got hit by sub7 before. I just dont know how i got it. It took me about 2 yrs to figure out which virus i had. I'm dumb!. then i started wanting to hack and i got sub7 just ot play around with it and i found the features in it that i had been affected by when i got the virus." - theforgotten

Go to: