04-14-2006 07:07 AM
04-17-2006 05:38 PM
04-18-2006 01:32 PM
Hi Megan,
One of my primary structs was defined in foo1.h and the other primary struct was defined in foo2.h. I have two source files, foo1.c and foo2.c that both have #include's for both foo1.h and foo2.h. I declared a global variable of pointer to one of the primary structs and initialized it to NULL in foo1.c. Then I declared a global variable of pointer to the other struct and initialized it to NULL in foo2.c. I needed to access the global pointer to the struct from foo1.c in a function in the foo2.c file, so I declared an extern reference in foo2.c within that function. It worked fine for a while and then all struct popups in foo2.c just suddenly stopped working altogether. The popups in foo1.c always worked.
Just today, I moved the declaration for the global pointers into the header files and now I initialize them both in another source file. All of the struct popups are working again in all of the source files. I noticed the little delay while the IDE looked up the popup information when foo2.c was misbehaving, but the popup never appeared. Now it is appearing. Normally I use local extern references to variables from other source files and this time I used a global extern reference instead. Perhaps that played into the problem. I don't have time to re-create it, but if I stumble across it again, I may dig in and try to isolate it.
I have also seen one or two situations where I updated a struct definition in a header file (added or removed a struct element) and following recompile sometimes the struct popup didn't always reflect the latest changes. I had one source file in this same project where that was also the case but it hasn't happened in a week. Maybe the IDE was mad at me? 😆
Thanx,
Orlan
04-19-2006 04:21 PM
Hi Orlan,
Well I'm very glad the popups are working again, but it is somewhat mysterious. I'd like to have a better solution than suggesting that you avoid irritating the IDE 🙂 but I haven't come across any similar issues. If you do find any other information on reproducing this, please let us know!
Happy coding,
Megan B.
Applications Engineer
National Instruments
04-20-2006 04:10 PM
Well,
...The IDE is mad at me again
Actually, it had absolutely nothing to do with my re-arranging the structs in the header files earlier this week. There is definitely a bug in the IDE. I don't know what it takes to cause the popups to not appear yet, but I do know what does and what does not work to get them started again.
Of no use: recompiling the source file with the malfunctioning popup (Ctrl-K), making the entire build (Ctrl-M), marking the entire project for compilation and then making the build, switching between debug and release builds and then making the build, restarting CVI and then compiling, restarting CVI and making the entire build, deleting the build directory in the project folder and then recompiling the source file with the malfuncitoning popup
Only known resolution: deleting the build directory in the project folder and then making the build (will automatically detect the build directory is missing and will mark the entire project for compilation)
Again, this does not happen to all structs in the source file with the malfunctioning struct popups. But following the resolution outlined above, the popups immediately start working again. ![]()
Orlan
04-20-2006 04:25 PM
Megan,
I forgot to add recognition for you in my post, but actually you suggested the delete option in your item #1. That that did the trick. I still would like to figure out what gets it confused--at least if there is something that I can do to trigger the behavior. That might help with a resolution.
Thanx,
Orlan
04-21-2006 12:16 AM
#include <ansi_c.h>
#include <cvirte.h>
struct str_foo {
int i_test;
} gstr_foo[100];
struct str_foo2 {
int i_test2;
} *gstr_foo2;
int main (int argc, char *argv[]) {
if (InitCVIRTE (0, argv, 0) == 0) return -1; /* out of memory */
gstr_foo2 = calloc(100, sizeof(struct str_foo));
// gstr_foo[0]. //popup shows: i_test
// gstr_foo2-> //popup shows: i_test2
// gstr_foo[gstr_foo2-> //popup shows: gstr_foo, gstr_foo2
free(gstr_foo2);
return 0;
}
-----------------------
Compile this file first. Then uncomment the three gstr_foo lines, but do not recompile. Now position your cursor after the "." operator in the first previously commented gstr_foo. Press Ctrl+Space and it will complete 'i_test'. You can delete and re-enter the "." and the popup will alternatively appear with 'i_test'. Whatever, same thing. Now do it for gstr_foo2. It shows 'i_test2' as expected. But when you try the second gstr_foo, which has pointer notation inside of the array notation, the popup misbehaves. It should be showing i_test2 since this is the only available struct element in gstr_foo2. Notice the popup is at the beginning of the line, instead of at the end of "->" (where it should be) and that if you select something in the popup it either does nothing or it rewrites the beginning of the line.
Personally, I think this bug is what starts the whole mess for me. When I loose my popups, it tends to allow the outer struct to continue to show popups and the inner struct will not show popups anymore. I could not get this simple project to lose popups altogether, but it does show some misbehavior. It is a bit more complicated in my real code, something like: gstr_foo->widget.status = gstr_foo2[gstr_foo->thingy.doohickey].status; I loose popups for gstr_foo but popups for gstr_foo2 still work. And now the doggone 'delete the build directory' approach isn't even working anymore. ![]()
Orlan
04-21-2006 03:59 PM
Hi Orlan,
You are indeed correct, this is funny behavior. Thanks so much for posting such a complete method for reproducing this error. I have reported this to R&D (#3WKCASXE) for further investigation. I'm sorry for the inconvenience and I will certainly post if I hear anything back quickly.
Thanks for the feedback!
Megan B.
Applications Engineer
National Instruments