News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Need help: auto-complete can't find CreateFile

Started by jsandraw, January 15, 2010, 01:53:58 PM

Previous topic - Next topic

jsandraw

when type createfile...., auto-complete just give 'CreateFileMoniker'

but CreateFile can compile and run in the .cpp

How can I set proper for auto-complete to show 'CreateFile'?

jsandraw

Can't find CreateFile/CloseHandle, but auto-complete can find ReadFile/WriteFile, s.b. know why?

Loaden

Quote from: jsandraw on January 15, 2010, 01:53:58 PM
when type createfile...., auto-complete just give 'CreateFileMoniker'

but CreateFile can compile and run in the .cpp

How can I set proper for auto-complete to show 'CreateFile'?
I can confirm it. SVN6086


[attachment deleted by admin]

ollydbg

OK, I can confirm this.

This code does not work.

#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
   CreateFil
   return 0;
}


If you open the CC Debug dialog
see http://wiki.codeblocks.org/index.php?title=Code_Completion_Design#Code-Completion_debug_tool_dialog
, you will notice that "winbase.h" is not in the CC's file list, so this is the reason.

But this code works
#include <iostream>
#include <windows.h>
#include <winbase.h>
using namespace std;
int main()
{
   CreateFi
   return 0;
}




If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

MortenMacFly

windows.h should usually be enough. However, you find this section in windows.h:

#ifdef RC_INVOKED
/* winresrc.h includes the necessary headers */
#include <winresrc.h>
#else

#include <stdarg.h>
#include <windef.h>
#include <wincon.h>
#include <winbase.h>
(...)

As CC does not fully support macro handling the first case (as if RC_INVOKED would be defined) is used. Thus the references are incomplete. However, I don't know "who" usually defines this macro. It looks like the resource compiler does so at runtime (compile time).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

MortenMacFly

#5
BTW:

Concerning macro handling: One thing that could "easily" be done is the following:

Similar like we cache the internal GCC dirs we could also cache the internal macros like this:
gcc -E -dM a_dummy.c
...and similar for g++.

This could be tried to resolve when we come across a macro. We are able to identify the name of the macro already.

...just my 2 cent...

Edit: Hey, this is my 4000th posting!!! :lol: :lol: :lol:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

ollydbg

#6
Quote from: MortenMacFly on January 15, 2010, 03:41:03 PM
BTW:

Concerning macro handling: One thing that could "easily" be done is the following:

Similar like we cache the internal GCC dirs we could also cache the internal macros like this:
gcc -E -dM a_dummy.c
...and similar for g++.

This could be tried to resolve when we come across a macro. We are able to identify the name of the macro already.

...just my 2 cent...

Great Idea.
I have a discussion with NullWu( who supplied a script engine to handle macros, see Partial C/C++ preprocessor function for codecompletion), I think we can also consider it.
By the way, what does this sentence means "...just my 2 cent.."???
Also, I saw some blog about Visual C++ 10's intelligent sense. They can both handle the #if and # else statement.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

jsandraw

Quote from: MortenMacFly on January 15, 2010, 03:41:03 PM
Hey, this is my 4000th posting!!! :lol: :lol: :lol:

Congratulation, U're the Lucky-MAN. :-)