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
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 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
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 Microsoft Visual Studio 2013, how can I add the external library libusb to my project?
libusb will contain a LIB file, DLL file and header file. You will need to include the libusb header file in your source project. Then under your project settings you should go to the Linker section and add the LIB file as a linked object. Then, just ensure your DLL is accessible to your executable when running or debugging.
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.