User forums > General (but related to Code::Blocks)
Auto-completion compatible C standard library
(1/1)
Hendi48:
Hello,
I recently started using Code::Blocks 16.01 after my C project became too big to develop comfortably in Notepad++. One of the features that are really useful in NP++ is that it's aware of the C standard library and provides function prototypes with argument types and names when typing "memset(" etc.
Now, to get this type of behaviour in C::B, I figured I had to add the include folder to the compiler search path (I'm using GCC 6.1.0 from msys2/mingw). So far, so good. What it shows me now is this: "char* memset()". I guess it fails to properly parse the header, since it's written in a slightly convoluted way...
--- Code: ---_PTR _EXFUN(memmove,(_PTR, const _PTR, size_t));
_PTR _EXFUN(memset,(_PTR, int, size_t));
char *_EXFUN(strcat,(char *__restrict, const char *__restrict));
--- End code ---
I also tried MSVC headers, but there it's even worse with 50 annotations for every function.
Is there any easy way to get IDE-friendly headers, preferably even with argument names?
ollydbg:
I think CC can handle such kinds of macros, if you search our forum by "_EXFUN", you will see some discussions. Such as: Is it possible for the parser to support newlib prototypes?
ollydbg:
Try to put those content in the main.c file of your project. (Note main.c is the only source file in your project).
--- Code: ---#define _EXFUN(name, proto) __cdecl name proto
FILE * _EXFUN(fopen, (const char *__restrict _name, const char *__restrict _type));
--- End code ---
Now, after that, type "fopen", and see whether it will prompt the correct auto completion. It works fine here in my C::B.
Navigation
[0] Message Index
Go to full version