Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Dev-cpp, code completion

This thread is locked; no one can reply to it. rss feed Print
Dev-cpp, code completion
Audric
Member #907
January 2001

Is it possible to configure Dev-cpp to suggest Allegro functions in code completion.

(Code::Blocks does not work on this computer, but thanks for the suggestion)

Indeterminatus
Member #737
November 2000
avatar

Man, it's been a while since I last used Dev-Cpp, but there is the possibility, yes. I don't have it installed, so I cannot check; I remember, though, that one can configure the paths for the cached source -- which also enables those sources for code completion.

Sorry, I cannot tell you more details. Hope this helps you anyway ;)

_______________________________
Indeterminatus. [Atomic Butcher]
si tacuisses, philosophus mansisses

Timorg
Member #2,028
March 2002

In my experience, get the installer without mingw, and get the mingw installer of the sf project page (http://sourceforge.net/project/downloading.php?group_id=2435&filename=MinGW-5.1.3.exe)

Install mingw to c:\dev-cpp or somewhere convenient, install allegro, and any other libs that you want code completion in. Then install dev-cpp into that directory, ignoring the directory already exists warning. As its installing it will ask if you want to create the cache, just say yes. Then you are all set.

You can manually create the cache on a current install, but I find I miss directories usually.

-Tim

____________________________________________________________________________________________
"c is much better than c++ if you don't need OOP simply because it's smaller and requires less load time." - alethiophile
OMG my sides are hurting from laughing so hard... :D

Audric
Member #907
January 2001

Thanks for the tips.
I found the options in Tools, Editor Options, Class Browsing, Completion:
- Check Use code-completion cache
- Add the allegro.h file, wherever it is. Dev-cpp finds and scans the allegro/ dependencies.

Now this is very frustrating because:
- In all files, tooltips start reacting for things like BITMAP, RGB. But they don't detect Allegro functions, unless I rewrite the headers to get rid of the AL_FUNC wording :-/.
- The undocumented Ctrl-Space panel (which resembles Intellisense's code completion) proposes only symbols from current file. I only managed to see Allegro symbols when I edit allegro.h itself :-/ I can't see any way to make the symbols visible when I edit my own code.

Indeterminatus
Member #737
November 2000
avatar

The things you mentioned (among others) basically made me switch from Dev-Cpp to Eclipse/CDT. I know this doesn't help you much, but I'm afraid these things won't go away (and I didn't find a decent workaround), as Dev-Cpp is no longer actively worked on.

_______________________________
Indeterminatus. [Atomic Butcher]
si tacuisses, philosophus mansisses

Thomas Fjellstrom
Member #476
June 2000
avatar

I recall that baf added support for allegro to generate a proper autocomplete setup for devcpp. Its one of the makefile options afaik.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Audric
Member #907
January 2001

I grepped in the 4.3.10 makefiles, but didn't find anything related.

But I solved it, woo-hoo ;D For the record:
(method below is edited, as compilation failed)

[list ordered]

  • I made sure to disable the mingw shipped with Dev-cpp, by misplacing its lib/ and include/ directories. (IMO, redundant compilers can only be a source of mistake)

  • Properly set my clean install of c:/msys/mingw as the compiler for Dev-cpp. Include and library directories: blank. Add the following commands when calling the compiler: -I c:/msys/mingw/allegro/include (1)

  • In my project settings, chose mingw as the compiler.

  • (In the allegro build directory, calling "make install" copies the lib and headers to mingw's directories)

  • Now, in c:/msys/mingw/include:<code>echo #ifndef ALLEGRO_H > allegro2.h

  • echo #define ALLEGRO_H >> allegro2.h
    gcc -E -DALLEGRO_NO_COMPATIBILITY allegro.h | grep -v "^#" >> allegro2.h
    echo #endif >> allegro2.h

    rm -rf allegro
    rm allegro.h
    mv allegro2.h allegro.h</code>
    This wipes the allegro include header and directory, replacing it with a single, 125Kb-heavy, header-guarded allegro.h, excluding any deprecated symbols.

  • In Dev-cpp: Tools, Editor options, Class browsing, Completion: Check Enable code-completion and Use code-completion cache.Click Add and select in wingw's includes the ones you are likely to want code tips for: allegro.h, stdio.h, stdlib.h, etc...

  • [/list ordered]

    There, everything works:

    • The code completion panel automatically opens after a -> or . and it proposes the struct members,

    • It opens with Ctrl-Space, after you've typed a prefix like "inst"

    • Hovering over any symbol shows a tooltip with its definition / prototype

    • While typing function arguments, another kind of tooltip opens after "( " and ", " (the space is required). It shows the function prototype, but also highlight the argument position you're in.

    Thanks all... I know it's nothing revolutionary, but I tried 5 IDEs before getting there, I'm glad it wasn't for nothing.

    (1) This ensures Dev-cpp scans the tweaked file when there is a #include <allegro.h>, but the actual compilation will use the original file tree from allegro build directory.

    Go to: