FLTK on Visual Studio 2019 x64, "Cannot open include file: 'dirent.h': No such file or directory - c++

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.

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.

The way I would create an x64 solution is
Open ide\VisualC2010\fltk.sln
If you are using another version of Visual Studio, let it convert.
Change the solution configuration to Debug (somehow Visual Studio always defaults to Debug Cairo)
Click on solution platforms and select Configuration Manager
When the Configuration Manager appears, under Active solution platforms select New
When the next dialog appears, under type or select new platforms select x64
Click on the OKs etc to close the windows
Now change the solution platform to x64 and start the build.
You shouldn't get any dirent.h errors.

Related

error while building a Hello World wxwidgets app with visual studio 2019

I'm trying build wxwidgets Hello World sample program in visual studio and i'm using prebuilt wxwidgets instead download that and build it myself.
and after configuring visual studio project for wxwidgets i always facing with this error:
Error C1083 Cannot open include file: '../../../lib/vc142_x64_dll/mswud/wx/setup.h': No such file or directory wxwidgets_programming_cpp C:\wxwidgets\include\msvc\wx\setup.h 140
where is the problem. I think i configured visual studio project in a wrong way. can you help me how to configure visual studio project for a regular wxwidgets app?
You need to define wxMSVC_VERSION_ABI_COMPAT in the preprocessor definitions to use these binaries, which will result in using the correct vc14x prefix instead of vc142 used by default. This is already supposed to be done by wxwidgets.props, at least for the DLL configuration which you seem to use, so I am not sure why it doesn't work for you if you do use this file, but at any rate this symbol must be defined and it isn't in your case.

Eclipse CDT - Cannot open include file: 'windows.h' (Microsoft SDK)

I'm trying to get Eclipse to build a project which was originally designed using Visual C++ (version 2008). I'm using the Microsoft Visual C++ toolchain.
When I try to build the project, I get the following error:
C:\...\types.h(25) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
I've found some posts suggesting that I should download the Microsoft SDK and add the directory containing windows.h to the path. The problem is, Microsoft SDK (at least the version I downloaded, which is Windows SDK for Windows 8.1) does not contain such file.
Is there a way to obtain windows.h and all of its underlying headers (assuming that is the problem)? And if that's not the problem, what could be the solution?
Please notice I'm a real beginner to Eclipse and I have never used Visual, so I think there's no such thing as a too detailed answer.
If you need further information or did not understand something I wrote (English is not my mother tongue) please let me know.

Linker: cannot open file 'nafxcwd.lib'

I have problem with compiling my project via visual studio 2013. I got this linker error:
LINK : fatal error LNK1104: cannot open file 'nafxcwd.lib'
According to this page, I must use MFC in shared library. But I don't use MFC at all.
All my libraries and main project compiled using Use Standard Windows Libraries settings. This problem occurs only when I try to build project via Visual Studio 2013 toolchain, but it successfully built with Visual Studio 2010 toolchain.
P.S. project has been moved from Visual Studio 6.0 to Visual Studio 2013.
It appears that in Microsoft Visual C++ 6.0 Standard Edition does not support statically linking with the MFC libraries as the Microsoft page says . But in Visual Studio 2013 you can link staticaly with Microsoft Libraries . Check this link https://support.microsoft.com/en-us/kb/243458 in order to solve your problem.
From The Microsoft Site :
To change your MFC project setting to link dynamically to the MFC libraries, perform the following steps:
Open your MFC project.
From the Project menu, click Settings.
In the Settings For combo box, select All Configurations. Click the
General tab. If it is not visible, use the tab scroll buttons to
scroll to the left.
In the Microsoft Foundation Classes combo box, select Use MFC in a
Shared DLL. Click OK to save the changes.
I had the same issue except it compiled on one machine but not another. Solved by installing the Multibyte MFC Library for Visual Studio 2013 as suggested in: MBCS Error building MFC C++ project with Visual Studio
To isolate the culprit that consumes MFC, link with /VERBOSE and search the output for nafxcwd. Most probably it would appear after a /DEFAULTLIB directive - just note which library was loaded exactly before the directive.
Going through updating a VS 2008 project which did not use MFC at all, I faced this same problem and fixed it doing these three steps. Please see the shot to have a glance on the properties of the project (VS 2008) highlighted.
Step-1
Please add this line #define _AFXDLL in your stdafx.h file
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _AFXDLL
Step-2
Go to your VS 2013 solution and open "Project Properties -> C/C++ -> Code Generation -> Runtime Library" and change the value to Multi-threaded Debug DLL (/MDd) (adjust your release configuration to Multi-threaded DLL (/MD), once you will complete these two steps you will start getting this linking error
error LNK1104: cannot open file 'mfc120d.lib'
Now, here you have to set the "Character Set" for your project to Unicode instead of _MBCS
Step-3
Now open "Project Properties -> General -> Project Defaults -> Character Set" and change the value to Use Unicode Character Set, now this part requires little more patience and work, you have to change your string traits to either wchar_t or TCHAR in your source files.
Hope it would solve your problem.

visual c++ program issue

I am using Microsoft Visual Studio 2010. When I am building my application in Debug mode, it is producing an EXE file (like it is supposed to be doing). But then (which is very surprising for me), when I change the mode from Debug to the Release mode, the compiler builds the application as a .DLL file?
I have only very recently started to use Visual Studio 2010, so don't know my way around it yet. How do I fix this so that when it is compiling in Release mode, to build the application as an .exe file ?
Set your project type to Windows Application.
In the IDE, right click on your project, and select Properties.
Configuration Properties->General->Configuration Type set to 'Application (.exe)'
In project options you should be able to choose whether you're building a .DLL or .EXE. I thought these were the same for all configurations, but you can check to see for yourself.

can you create a lib or dll in VS 2005 and link with VS 2008

I am using visual studio 2008 SP1.
And I am creating a desktop application using MFC.
I have a library I want to link with my application. However, the library was written in WIN32 visual studio 2005.
I am been having a trouble linking:
fatal error LNK1104: cannot open file 'AgentLib.lib'
I am wondering if it is because I am using MFC 2008 and the library was written and compiled with 2005?
Many thanks for any advice,
Make sure you have added the path where your lib files are under project settings in Linker>General>Additional Library Directories
There should be no problem to do that.
You can either
Add the directory where AgentLib.lib is to the library directories of your project.
Add AgentLib.lib to your project (you may get a message box from Visual Studio asking for a rule, but there is no need for one, and it works)
Yes it is possible. f you have issues please Check this links for some help. Also check for any dependent file which is being used by the lib created using VS 2005.