[HOW-TO] Include the systems headers with Juce [RESOLVED]


#1

Hi all,

I need to use directly some <windows.h> struct and definitions. But since “juce.h” is included i’ve a lot of error with “winnt.h” ?

Is a macro that allow to use some native headers conjointly with juce ?

[ADDITION NOTE]
For information, the system headers are already managed in Juce. My question is about the visibility and use of the system defintions and structures. In VS2008, when I want to use some of these, I need to add a #include <window.h> in my sources files. My problem is not without juce.h included. I don’t know if i’m clear?

Thank you for your answer.
Max


#2

I’m not sure quite what you’re asking, but you can include windows.h just fine, if you ensure that it is included before juce.h.

I.E.

#include <juce.h>
#include <windows.h>

will fail, but

#include <windows.h>
#include <juce.h>

will work.


#3

Thank’s for reply.

Yes, but don’t work here because i’m using the <windows.h> include in some classes and when juce.h is already included before.

Maybe I need to globalize my juce.h include (a sort of MainHeader.h include in each files instead to include juce.h each time i need) ?

I’ve this error :
//==============================================================================
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(964) : error C2988: impossible de reconnaître la définition/déclaration de modèle
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(964) : error C2059: erreur de syntaxe : '('
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(964) : error C2090: tableau retourné par la fonction
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(964) : error C2988: impossible de reconnaître la définition/déclaration de modèle
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(964) : error C2059: erreur de syntaxe : ')'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(1773) : error C2143: erreur de syntaxe : absence de ‘;’ avant '*'
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(3575) : error C2143: erreur de syntaxe : absence de ‘;’ avant 'identificateur’
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(3575) : warning C4091: 'typedef ' : ignoré à gauche de ‘_FLOATING_SAVE_AREA’ quand aucune variable n’est déclarée
1>c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(3575) : fatal error C1075: fin de fichier rencontrée avant que l’élément accolade ‘{’ gauche de ‘c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(22)’ soit équilibré
//==============================================================================
the first error is about the impossibility to find a definition of template, the last error is about the equilibrity of the file, seem like conflict with macro or something like that ? Maybe the T() macro ? Don’t know, i’m not too experimented at this level to have a solution.

Jules ? Maybe a solution for me ?

In all case, thank you Valley !


#4

That’s what I do.


#5

Hi matt,

The global header correct this problem you think ? I want to be sure because I need to change a lot of file, you understand.

Sorry for doubt, I’ve tested the principle, it’s ok :slight_smile:

Thanks a lot,
Max


#6

you can do that, and as long as you don’t include this header(one containing juce.h ) file before including windows.h, there would be no errors. Or you can put them in this order

#include "windows.h"
#include "juce.h"

But why do you want to use it. Because someday if you edit this header file, the visual studio would compile all the files including the header file.

Simplest thing to do would be to add windows.h as the first header file to be included in the source file.


#7

I need to include <windows.h> because I need to access to platform specific defs for printing (such PRINTDLG for example).

But it’s ok while I generate a global headers that place the #include <window.h> before a single global #include “juce.h”.

I don’t know if it’s other ways to include all of that. But i don’t need to modify anything in theses files, just use it.

Thank’s to all for theses advices.
Max


#8

There is another way out but it’s all left to you, you have to include windows.h in the files you get error, “windows.h” should be the first file included.


#9

thanks man :wink:


#10

always ready to help. :slight_smile: