News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Could Code::Blocks list the members of a struct or class?

Started by norsd, October 09, 2008, 08:37:54 AM

Previous topic - Next topic

norsd

As I was using VC, for example, "WNDCLASSEX wincl" , if I enter "wincl." and VC will show me the member list,

but i cannot find that  in CB.

Can any one who can help me?

I think i'm loving CB, but ,.....but ....... TvT

Ok, i found one thing, if the struct is defined by file which is one of the current project, CB can list the member,

but, when the struct is defined outside, such as "WNDCLASSEX" which is defeind in <windows.h> ,then, nothing happened!!

Thanks~



norsd

Is there any one who can help me?

My CB can only list member which is defined in current file.

How could I remember the whole members of windows structs and functions!?

Hello?  TvT~

MortenMacFly

Quote from: norsd on October 13, 2008, 06:12:58 PM
Is there any one who can help me?
Did you create a project or do you use single file compilation?
It it's the latter: Please create a project.
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]

norsd

Thank you for replying

My project : Projects ---->  Win32 GUI Project -----> Frame based ------>  Input Project Name ------> GNU GCC Complier

File : (only one) main.cpp

LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "CodeBlocksWindowsApp";

int WINAPI WinMain (HINSTANCE hThisInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpszArgument,
                     int nCmdShow)
{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);
   
...............................................................................


Then, when I input "wincl." , nothing happened........>_<

MortenMacFly

Quote from: norsd on October 14, 2008, 01:32:50 PM

    WNDCLASSEX wincl;        /* Data structure for the windowclass */
    /* The Window structure */
    wincl.

Then, when I input "wincl." , nothing happened........>_<
In Windows WNDCLASSEX is either _WNDCLASSEXA or _WNDCLASSEXW, depending whether you do an ANSI or Unicode build of your application. CC works just fine if you try to code complete e.g. _WNDCLASSEXA which is defined in winuser.h (btw.).

To be honest: I have no idea how this works internally as you'll find nowhere in the header files the mapping of WNDCLASSEX. (I would have expected a typedef or similar embedded in an unicode/ansi #ifdef.)

Thus CC cannot find the token and won't work therefore.
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

Completely forgotten:

BUT there is a work-around:
- Go to menu "Settings" -> "Editor" -> Code completion
- Select the tab "C/C++ parser"
- in "Replacement tokens" add:
  WNDCLASSEX -> _WNDCLASSEXA
(or in the case of unicode:
  WNDCLASSEX -> _WNDCLASSEXW)

Let the project re-parse (right click on the symbol tree and select "Re-parse") and it'll work.
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]

norsd

Thank God.
Thank you Morten.
But.......
Complex..... as an FOOL C++ developer , why do I need to do so many things to correct my lovely IDE?

norsd

Yes, when i defined like that :" _WNDCLASSEXW stTest; " , the Code Complete works.
Fine, but nothing is better now.

As you know, there are many projects which are based on both two codes(unicode and non-unicode ).
In these projects there are so many "typedef" and so many "#ifdef UNICODE" in header files , WHAT SHOULD I DO for that?

I want to cry........

MortenMacFly

Quote from: norsd on October 15, 2008, 12:05:07 PM
WHAT SHOULD I DO for that?
Just add both:
Quote from: MortenMacFly on October 15, 2008, 11:27:52 AM
- in "Replacement tokens" add:
  WNDCLASSEX -> _WNDCLASSEXA
AND:
  WNDCLASSEX -> _WNDCLASSEXW)
Quote from: norsd on October 15, 2008, 12:01:32 PM
why do I need to do so many things to correct my lovely IDE?
That's not an IDE issue but an issue with the MS SDK framework. Probably you have realised that C::B support a lot compilers. So we cannot handle each and every special freaky thing (compiler) frameworks ship with.
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]

norsd

As a deep developer in CB, could you tell me is that can be truth that someone would(could) make a plugin to make the CC perfect, I mean that the CC would "know" typedef , #if, #else and so on .

And I also found the new type which you defined by typedef would not be set as a color, for example,blue;
But AssistX as an add-in of VS, can do that excellently.

MortenMacFly

Quote from: norsd on October 15, 2008, 02:19:17 PM
someone would(could) make a plugin to make the CC perfect, I mean that the CC would "know" typedef , #if, #else and so on .
Sure thing, that would be possible.

Quote from: norsd on October 15, 2008, 02:19:17 PM
But AssistX as an add-in of VS, can do that excellently.
I am aware of this plugin. Hence there is a major difference:
1.) The devs there are (more or less) only develop the (a) CC plugin ("AssistX").
2.) They are getting good good money for it, so there is no need to have another job.
3.) They do not need to support any other compilers than the MS one.
4.) The development time to achieve this is way more than for whole C::B.

I guess I don't need to say anything else.
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]

norsd

Thank you, and that's all i think.
Thank you Morten. ;)
Good night

Wait....wait...........where is the source codes for CC?

MortenMacFly

Quote from: norsd on October 15, 2008, 07:17:18 PM
Wait....wait...........where is the source codes for CC?
Sure there is. It's part of C::B which is released under GPL. So you can freely do a checkout and modify the CC plugin in the way you want. Don't forget to provide us with the patches if you have achieved something... ;-)
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]

norsd

Oh, God , of course not.........
For I'm hating CB now.

Haaaa........ :)