04-23-2009 04:43 PM
Just installed CVI 9.0 and now my project generates an "Empty declaration" warning in ShObjIdl.h at line 1330
I'm including shlobj.h to support the use of SHGetFolderPath(), and shlobj.h in turn includes ShObjIdl.h
I believe I have the same compiler options as before with 8.5.1. I note there is a new SDK version with CVI 9 which likely factors into the explanation.
Is this any cause for concern?
--Ian
Solved! Go to Solution.
04-24-2009 10:56 AM
I confirmed that the warning does show up because of the following:
typedef enum tagSHCONTF
{
... // actual values omitted for brevity
};
The typedef is an empty declaration because it does not actually declare any new typename. You're correct that this is new to the updated SDK shipped in CVI 9.0. The previous version of shlobj.h did not include ShObjIdl.h. I confirmed that the same typename ommission exists in the ShObjIdl.h installed by the Windows SDK provided by Microsoft.
I do not see any reason to worry about this warning.
Mert A.
National Instruments
04-27-2009 08:04 AM
Thanks, Mert.
If you have any clever ideas on how to suppress just this warning (better than inserting a bogus typename into that read-only file), I'd appreciate it. I'd rather not see this every time I compile.
--Ian
04-27-2009 10:32 AM
Honestly, your best bet is probably to just temporarily make that file writable and throw some new typename after that enum.
But I do have another suggestion that allows you to leave the file alone. You can create a #define that essentially removes the typedef from the enum tagSHCONTF declaration by attributing it to a new, preceeding dummy enum declaration:
typedef enum shcontf_dummy { shcontf_dummy } shcontf_dummy_typedef; enum tagSHCONTF
#include <shlobj.h>
After the replacement, this becomes:
typedef enum shcontf_dummy { shcontf_dummy } shcontf_dummy_typedef;
enum tagSHCONTF
{
...
};
If you go this route, you'll have to add this to each source file that you include shlobj.h from.
Mert A.
National Instruments
03-10-2010 08:31 AM
Mert A. wrote:But I do have another suggestion that allows you to leave the file alone. You can create a #define that essentially removes the typedef from the enum tagSHCONTF declaration by attributing it to a new, preceeding dummy enum declaration:
I added the line
typedef enum shcontf_dummy { shcontf_dummy } shcontf_dummy_typedef; enum tagSHCONTF
(copy/paste from your post) just before the
#include <shlobj.h>
but now I have some compilation errors
Where is my mistake?
Using CVI 2009
03-10-2010 10:30 AM
Whoops. It looks like I made a copy/paste error in that post, and Ian never called me out on it. As I said, you have to add a #define, not a typedef:
#define tagSHCONTF shcontf_dummy { shcontf_dummy } shcontf_dummy_typedef; enum tagSHCONTF
#include <shlobj.h>
Sorry about that.
Mert A.
National Instruments
03-11-2010 01:27 AM
03-11-2010 07:47 AM
"Ian never called me out on it" .... guilty as charged! Time pressure forced me to hack that read-only file and I never posted back. Thanks, Vix (& Mert!) for bringing this thread to a proper conclusion.
--Ian