1

I am using the FLTK library in Visual Studio Community 2019 and building my application for x86 works fine. Now, I would like to build it for x64. However, I am getting the error "Cannot open include file: 'dirent.h': No such file or directory.".

The error occurs in the file, named 'filename.H'. This header file comes with the FLTK library.

Has anyone an idea how I could fix this problem?

Update:

The dirent.h library is not recognized, because its an C POSIX library, as described in the link here below. However, the question still remains, namely, how can I fix this problem?

<dirent.h> in visual studio 2010 or 2008

The link above refers to a link with an alternative dirent.h file. I've tried to include this file in my project, however, now another errors occur. These errors occur in the file Fl_Native_File_Chooser.H. The type specifiers fl_OPENFILENAMEW and fl_BROWSEINFOW are unknown in this file.

t.r.hogenkamp
  • 73
  • 2
  • 7
  • 3
    ***Has anyone an idea how I could fix this problem?*** Its the same as most third party libraries. Add the include directory for fltk to your "Additional Include Directories" setting for your project. Make sure you add this setting to all configurations in your project. – drescherjm May 04 '21 at 14:04
  • 2
    @drescherjm is probably right. On Visual Studio it can be easy to add a property for one configuration only, when you actually intended to apply that property to all configurations. You can have similar issues with Debug/Release, which is another configuration split. – MSalters May 04 '21 at 15:05
  • Thanks for your reply. I've the exact same configuration for both x64 and x86. – t.r.hogenkamp May 04 '21 at 15:31
  • 1
    @t.r.hogenkamp What about Debug and Release? Those are different too. – Casey May 04 '21 at 15:56
  • I've just tried building x64 debug and release using VS2010. It builds without any errors. – cup May 04 '21 at 17:42
  • How did you create your x64 solution? Was it a copy of the win32 from the ide directory? – cup May 04 '21 at 17:56
  • @cup What exactly do you mean by copy of the win32 from the ide directory? Could you tell me how you've setup FLTK in Visual Studio? – t.r.hogenkamp May 04 '21 at 18:07

2 Answers2

0

On Windows, dirent.h should not be included in the FLTK code. Even though it is 64 bit, WIN32 must be defined when using the FLTK libraries (https://www.fltk.org/doc-1.3/preface.html). Your problem will probably be solved if you define WIN32 at the beginning of your code or if you add WIN32 in your Visual Studio project properties - C/C++ - Preprocessor - Preprocessor Definitions, in x64 platform.

0

The way I would create an x64 solution is

  1. Open ide\VisualC2010\fltk.sln
  2. If you are using another version of Visual Studio, let it convert.
  3. Change the solution configuration to Debug (somehow Visual Studio always defaults to Debug Cairo)
  4. Click on solution platforms and select Configuration Manager
  5. When the Configuration Manager appears, under Active solution platforms select New
  6. When the next dialog appears, under type or select new platforms select x64
  7. Click on the OKs etc to close the windows
  8. Now change the solution platform to x64 and start the build.

You shouldn't get any dirent.h errors.

cup
  • 7,589
  • 4
  • 19
  • 42