Author Topic: Could Code::Blocks list the members of a struct or class?  (Read 9779 times)

Offline norsd

  • Multiple posting newcomer
  • *
  • Posts: 11
Could Code::Blocks list the members of a struct or class?
« on: October 09, 2008, 08:37:54 am »
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~


« Last Edit: October 09, 2008, 09:28:40 am by norsd »

Offline norsd

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Could Code::Blocks list the members of a struct or class?
« Reply #1 on: October 13, 2008, 06:12:58 pm »
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~

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Could Code::Blocks list the members of a struct or class?
« Reply #2 on: October 14, 2008, 11:31:41 am »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline norsd

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Could Code::Blocks list the members of a struct or class?
« Reply #3 on: October 14, 2008, 01:32:50 pm »
Thank you for replying

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

File : (only one) main.cpp

Code
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........>_<

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Could Code::Blocks list the members of a struct or class?
« Reply #4 on: October 15, 2008, 11:24:18 am »
Code
    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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Could Code::Blocks list the members of a struct or class?
« Reply #5 on: October 15, 2008, 11:27:52 am »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline norsd

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Could Code::Blocks list the members of a struct or class?
« Reply #6 on: October 15, 2008, 12:01:32 pm »
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?

Offline norsd

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Could Code::Blocks list the members of a struct or class?
« Reply #7 on: October 15, 2008, 12:05:07 pm »
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........
« Last Edit: October 15, 2008, 12:12:24 pm by norsd »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Could Code::Blocks list the members of a struct or class?
« Reply #8 on: October 15, 2008, 01:09:27 pm »
WHAT SHOULD I DO for that?
Just add both:
- in "Replacement tokens" add:
  WNDCLASSEX -> _WNDCLASSEXA
AND:
  WNDCLASSEX -> _WNDCLASSEXW)
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline norsd

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Could Code::Blocks list the members of a struct or class?
« Reply #9 on: October 15, 2008, 02:19:17 pm »
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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Could Code::Blocks list the members of a struct or class?
« Reply #10 on: October 15, 2008, 05:27:48 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.

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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline norsd

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Could Code::Blocks list the members of a struct or class?
« Reply #11 on: October 15, 2008, 07:17:18 pm »
Thank you, and that's all i think.
Thank you Morten. ;)
Good night

Wait....wait...........where is the source codes for CC?
« Last Edit: October 15, 2008, 07:23:51 pm by norsd »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Could Code::Blocks list the members of a struct or class?
« Reply #12 on: October 16, 2008, 08:42:53 am »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline norsd

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Could Code::Blocks list the members of a struct or class?
« Reply #13 on: October 16, 2008, 01:36:21 pm »
Oh, God , of course not.........
For I'm hating CB now.

Haaaa........ :)