[cfe-users] Clang (with Visual Studio) wrongly complains about missing variables

2021-09-20 Thread John Emmas via cfe-users
Hi there - I'm building quite a complex Windows program here using VS2019. Obviously there's an EXE and there's maybe 30 or so DLLs. Some DLL's might have code which looks like this in a header file:- class whatever { static int revision_num; }; or if there's no class involved

Re: [cfe-users] Clang (with Visual Studio) wrongly complains about missing variables

2021-09-20 Thread John Emmas via cfe-users
On 20/09/2021 12:36, John Emmas via cfe-users wrote: But if I switch VS2019 to use Clang (when building the EXE) Clang's linker will complain that it can't find the variable 'revision_num'. But of course, 'revision_num' is an internal variable that's private to the DLL [...] - so is there ma

Re: [cfe-users] Clang (with Visual Studio) wrongly complains about missing variables

2021-09-20 Thread David Blaikie via cfe-users
I'm not sure it's the right/necessary solution, but one way would be to move the function definition (for the_keyboard) out of line (define it in some .cpp/.cc/whatever file, not in the header) - if you don't want it to be inlined. On Mon, Sep 20, 2021 at 6:56 AM John Emmas via cfe-users < cfe-use

Re: [cfe-users] Clang (with Visual Studio) wrongly complains about missing variables

2021-09-20 Thread Jeffrey Walton via cfe-users
On Mon, Sep 20, 2021 at 7:37 AM John Emmas via cfe-users wrote: > > Hi there - I'm building quite a complex Windows program here using > VS2019. Obviously there's an EXE and there's maybe 30 or so DLLs. Some > DLL's might have code which looks like this in a header file:- > > class whatever