I keep receiving the error "cannot open source file" in Visual Studio 2015 when trying to compile the "simpleLite.c" from AR Toolkit. This occurs despite placing the the full paths to the headers in the project options include setting and also pasting the headers into the project headers folder.
AR Toolkit is installed as C:\Program Files (x86)\ARToolKit5
The include paths, which are pasted into the project include setting, are:
C:\Program Files (x86)\ARToolKit5\include\AR;
C:\Program Files (x86)\ARToolKit5\include\win32-i386\GL
All include files fail to open:
Is anyone aware of additional needed configuration?
The include paths, which are pasted into the project include setting, are: C:\Program Files (x86)\ARToolKit5\include\AR; C:\Program Files (x86)\ARToolKit5\include\win32-i386\GL
Seeing that the #include directives start with AR and GL, you probably should not have those subdirectories in your include paths, but just
C:\Program Files (x86)\ARToolKit5\include; C:\Program Files (x86)\ARToolKit5\include\win32-i386
Related
Currently I am trying to use the C standard library in my EDK2 project.
As my Visual Studio 2019 did not automatically add the necessary include directories,
I manually added the following folders to my include directories:
C:\edk2\MdePkg\Include\X64
C:\edk2\MdePkg\Include
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29812\include
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29812\atlmfc\include
C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Auxiliary\VS\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt
C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\Include\um
As this fixed my missing #include directives, the only thing left for me was to manually
add the missing libraries to the linker arguments.
I did this as follows:
1.) After a quick Google search i found out, that I have to link my application against libucrt.lib, which i then tried to locate inside of my Windows 10 SDK by performing a simple search, which yielded me the following results:
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x64
As a result, I added this directory to my library directories inside Visual Studio 2019.
Not to forget, I added libucrt.lib as well:
My problem is, that after compiling my project, I still get an error from the linker:
I already tried out using different include directories, as well as different Windows SDK versions,
but none seemed to solve my problem.
I am grateful for any kind of help, thank you.
I settled on implementing the functions I needed from the stdlib myself, as #user123 proposed, in order to solve this problem and save me a lot of time.
I want to use netCDF formats in a C project using Visual Studio Express 2013 on a Windows 64bit. I've downloaded the installation file from the official website and executed the .exe.
Then, I've looked into this post to see how I should do the linking etc.
More specifically, in my project in Visual Studio, I did the following:
Put #include < netcdf.h >
in VC++ Directories, Library directories, I added C:\Program Files (x86)\netCDF 4.3.3.1\lib; C:\Program Files (x86)\netCDF 4.3.3.1\bin;
in VC++ Directories, Include directories, I added C:\Program Files (x86)\netCDF 4.3.3.1\include; C:\Program Files (x86)\netCDF 4.3.3.1\bin;
in the linker>input>Additional Dependencies, I added netcdf.lib (and all other .lib files I found in the \lib folder of netCDF 4.3.3.1
Placed all .dll files of the \bin folder of netCDF 4.3.3.1 in Windows\System32 and Windows\SysWOW64
However, when I run the project (F5), it gives the following 2 errors:
error LNK2019: unresolved external symbol_nc_strerror referenced in function _main
error LNK1120: 1 unresolved external --> which is, I assume, due to the first error.
I'm a almost completely new to C programming and Visual Studio. Could somebody help?
Thanks in advance!
I finally got it working with help of others. Here are the (detailed) steps that worked for both Visual Studio 2010 as Visual Studio 2013.
I have a 64bit Windows machine, but used version 4.3.3.1 (32-bit) of the netCDF. The reason that I choose 32-bit was because 32-bit code can run on both 32- and 64-bit machines. The whole setting in general includes three parts: library installation, configure Environmental variables for your computer, and configure Properties for Visual studio.
The following are the step by step settings on my PC.
1. The netCDF library was installed at C:\Program Files (x86)\netCDF 4.3.3.1
2. Go to 'Computer', right click, and choose 'property' -> Advanced system settings -> go to 'Advanced' tab page -> click 'Environmental Variables' -> At 'System variables' field, look for a variable called 'Path', then click 'Edit'
-> Append the following to the current path variables (';' is used to separate variables):
;C:\Program Files (x86)\netCDF 4.3.0\bin;
3. Go to Visual studio -> Project -> Properties -> Click 'VC++ Directories' (one of the Configuration Properties) -> Edit the value of 'Include Directories' field by adding 'C:\Program Files %28x86%29\netCDF 4.3.3.1\include' -> Edit the value of 'Library Directories' by adding 'C:\Program Files %28x86%29\netCDF 4.3.3.1\lib'
(still in the Properties) Go to Linker / General (another Configuration Properties) -> make sure 'Enable Incremental Linking' field is 'No' -> Edit 'additional Library Directories' by adding the following two paths:
C:\Program Files %28x86%29\netCDF 4.3.3.1\lib
C:\Program Files %28x86%29\netCDF 4.3.3.1\bin
(still in the Linker) -> click Linker / input -> Edit 'Additional Dependencies' by adding 'netcdf.lib'.
Properties setup done. In the C/C++ code, you just need to include netcdf library using
include
Note that for the older 4.3.0 version, other directories are also included (deps/shared). These are not listed separately anymore in the newer 4.3.3.1 version, but added directly to the \bin and \lib directories.
Can't build driver, Visual Studio 2012
error C1083: Cannot open include file: 'fltKernel.h': No such file or directory
You need to add
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\km
to
Additional Include Directories
in C/C++ / General
I assume that's with the Windows 8 WDK? Just make sure that the header was installed in your kits header directory ("C:\Program Files (x86)\Windows Kits\8.0\Include\km"). Also note that fltKernel.h is a kernel mode header, so you can only include it in kernel mode driver projects.
If the header is missing from your installation, I'd recommend reinstalling the WDK. If it is not missing and it still isn't found for some reason, you could try manually adding its absolute path to your list of included headers to see if it fixes the issue. If that works (it should), then you can figure out why it was missing from your include path in the first place.
The file is part of the windows driver kit, likely you need to configure your build tool to use the correct windows SDK. (and also make sure you have go through your setup on Visual Stdio to add the SDK)
I am using libsodium in a c project using visual studio with the normal way of including headers and lib file with "Additional Headers Directories" and "Additional Library Directories".
What I want to ask if it is possible to add the headers to
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include"
and the .lib file to
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib"
so that it is included by default in any project I use ? and if it would be considered bad practice ?
Thanks
I have VS 2010 installed on my system and i was trying to compile a simple hello.c in VS command prompt. The compilation gave an error.
Fatal Error C1083: Cannot open include file: 'stdio.h' no such file, folder exist
Why this error is coming ?? Does VS2010 not include reference files/assemblies for C.
VS 2010 certainly does contain the standard headers. You should check that your command prompt environment is set up correctly. There should be an environment variable named INCLUDE that has a directory similar to the cfollowing (among other directories) in it:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE
that directory (the name may vary slightly, for example depending on if your machine is a 64-bit OS of not) should include stdio.h
If you don't have such a directory in your environment, then you're not setting up the environment correctly. You should use on of the "Visual Studio Command Prompt" shortcuts that VS installs, or simply run
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat
With the appropriate parameter to get the environment you want (x86 or amd64 for example).
If the INCLUDE environment variable does have an entry like that, but the stdio.h file doesn't exist, then you might need to reinstall VS.
I had a similar problem as the OP the VC folder was missing most of the files. I tried both repairing and uninstalling/reinstalling VS 2010 but neither worked.
What worked for me was installing the Microsoft Visual C++ 2010 Redistributable Package (x86).Microsoft Visual C++ 2010 Redistributable Package (x86)
There are so many versions of so much Windows system code that it's easy for a path to become invalid.
In my case:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include
and
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib
needed to be changed to::
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
and
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
i.e. v7.1A -> v7.0A (don't ask why, it just part of the everyday, tiresome task of dealing with Microsoft!).
I had the same problem. The file stdio.h did not exist in folder include. I removed VS 2010 using the Control Panel then reinstalled, but this didn't solve the problem.
I then used the VS 2010 installation CD to remove all of VS 2010, and manually removed anything leftover by Control Panel. I then installed VS 2010 professional again. The problem was solved.