I am working in visual studio and i have got two projects in a solution.
I want to refer to header file of second project in my main-project.
I added second-prj as a reference to my main-prj,. But when i write like
#include "Second_Project_File.h"
in my main-prj it gives compile errors :
fatal error C1083: Cannot open include file: 'Second_Project_File.h': No such file or directory.
Then i looked at the folders and gave relative path like
#include "..\Second_Project_Folder\Second_Project_File.h"
it compiled but gave error :
main-prj.exe not found or not built by the last incremental link; performing full link
Embedding manifest...
What should i do?
i donot want to work with this kind of including header files
#include "..\somefolder\header.file.h"
How to do this in visual studio.
Thanks.
Related
I have downloaded and tried to build The oxygine engine project with VS 2017 Community. The stringutils.cpp file from it gives me the following when I try to compile:
C1083: Cannot open include file: 'SDL_stdinc.h': No such file or directory
hovering the #include statement it says cannot open source file 'SDL_stdinc.h'
I checked
Properties->C/C++->General->Additional Include Directories
and it references the path the header files are in. I have even added another path representing the absolute path. I tried a different folder, a different download of the header files, all to no avail.
What do I need to do to get this right?
Is there any reason for a header to not work? (version mismatch or something)
Is a header not working if the corresponding dll or lib is missing?
If so, how do I know it is found by VS?
The problem was the path for oxygine in the oxigine project properties was setup like this ..\..\..\..\SDL\include\ but had to be setup like that ..\..\SDL\include\
I use Visual Studio 2013 to build a program. I have got some problems...
a) an error:
c:\users\wojciech\desktop\cryingdamson 0.3.6 (8.60) v8.2 source\otpch.h(28): fatal error C1083: Cannot open include file: 'libxml/xmlmemory.h': No such file or directory
My code:
#include <libxml/xmlmemory.h>
I have included that file in Visual Studio 2013 to header files and I have even it at libxml folder. I can not still build solution (compile) because of that error.
Please help me, I am new to Visual Studio. I have tried to add xmlmemory.h file to project properties, but it seems that it doesn't see the file.
Okay, in folder "c:\users\wojciech\my documents/visual studio 2013/projects/consoleapplication3" there is a file named MainProject.sln, which type is microsoft visual solution. In the same folder I have added libxml folder and in the folder I have put xmlmemory.h. The problem is I still can not compile the program.
I use windows 7.
You Need to add the parent Folder of libxml to the include path. Say if the Folder structure Looks like
some_project
include
libxml
xmlmemory.h
...
you Need to add the include Directory to the include path
Where is your xmlmemory.h? Of #include <.../libxml/xmlmemory.h> try a complete path in the ... part.
The path libxml/xmlmemory.h is in fact ./libxml/xmlmemory.h where ./ means the location of your workspace.
===============Next is added according to your comment==========================
Just using #include "..\libxml\xmlmemory.h" would compile. So your workspace path is therefore c:\users\wojciech\my documents/visual studio 2013/projects/consoleapplication3. Under your workspace there should be a folder MainProject where your existed source files are located. So .\ means the path c:\users\wojciech\my documents\visual studio 2013\projects\consoleapplication3\MainProject.
Note that you should use \ other than / to represent your file hierarchy in your project and that you should use "xxx.h" other than <xxx.h>.
You can also use this method: open VIEW->Property Manager, right click on MainProject and open Properties, in C/C++ -> General -> Additional Include Directories, add your folder libxml to it. Then all files under your libxml folder would become a part of your solution. You can just use #include "xmlmemory.h>" to make it compile.
Either way is supposed to compile.
I'm attempting to compile a C++ solution in VS 2010, but for some reason it can't locate the standard libraries.
I'm including as so:
#include <cstddef>
VS is returning an error as so:
main.cpp(10): fatal error C1083: Cannot open include file: 'cstddef': No such file or directory
However, I check my installation directory, and it's right where it's supposed to be (VC\include), and this directory is a part of my include directory list in the project settings ($(VCInstallDir)include).
Any ideas why this is happening, and how I can fix it?
Give a try using #include <stddef.h> instead.
However, MSVC 10 should have <cstddef>: msdn
However, as #captain-obvlious pointed out this may require additional changes in your code..
Hi I am using google sparsehash library. When i compile the code (Visual Studio 2005)it gives following error...
fatal error C1083: Cannot open include file: 'sparsehash/sparse_hash_map': No such file or directory
What is the reason behind this problem and what is its solution.
Thanks in advance...
Make sure you installed https://code.google.com/p/sparsehash/ and your makefile correctly updated to include header file from this sparsehash i.e. something like
-I ./sparsehash/include
In case of Visual Studio make sure your project setting refer to path where file is located.
Building with/ Using VS2010
Platform SDK (Microsoft Windows SDK v7.1) installed.
When i try to build the Sample LSP (located in C:\Program Files\Microsoft Platform SDK\Samples\NetDS\WinSock\LSP)
!--BEGIN RESOLVED--!
I get 16 of the same two errors below.
Error 1 error C1083: Cannot open include file: 'nt.h': No such file or directory c:\program files\microsoft sdks\windows\v7.1\samples\netds\winsock\lsp\nonifslsp\lspdef.h 22 1 LSP
Error 7 error C1083: Cannot open include file: 'lspcommon.h': No such file or directory c:\program files\microsoft sdks\windows\v7.1\samples\netds\winsock\lsp\install\instlsp.h 35 1 LSP
When i added the source code of this sample to VS, i use File>New ProjectFrom Existing Code.
Once i do that, VS starts importing all the Platform SDK include files. I was reading elsewhere that not having the includes from PSDK would cause problems, but this doesnt seem to be the case here.
!--END RESOLVED--!
I now run into 3 more errors after fixing the above problem:
Error 1 error LNK2005: "struct _GUID gProviderGuid" (?gProviderGuid##3U_GUID##A) already defined in lspguid.obj C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\netds\winsock\lsp\instlsp.obj LSP
Error 6 error CVT1100: duplicate resource. type:MANIFEST, name:1, language:0x0409 C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\netds\winsock\lsp\CVTRES LSP
Error 7 error LNK1123: failure during conversion to COFF: file invalid or corrupt C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\netds\winsock\lsp\LINK LSP
I have not changed any of the contents/files in the LSP sample.
Currently I'm just trying to build it.
Any insight on this would be helpful.
Thanks.
The file lspcommon.h is part of the LSP sample, you should be able to find it in the 'common' subfolder. (C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\netds\winsock\lsp\common)
If you double click on one of your errors the editor will open focused on the line that's giving problems. Do that for lspdef.h line 22 and you'll see the code looks like this...
#ifndef _PSDK_BLD
#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#endif
That means, the nt.h file (and two others) is only included if the macro _PSDK_BLD is not defined. Look a little lower at line 35 and you'll see the code looks like this...
#ifndef _PSDK_BLD
#include <lspcommon.h>
#else
#include "..\common\lspcommon.h"
#endif
In this case, if the macro is not defined the code includes the file lspcommon.h, but if the macro is defined then the code includes the file lspcommon.h from the common foider.
It seems likely then that your problems are happening because _PSDK_BLD is not defined. From the style of the #ifdef it doesn't look like the macro has to be defined to any specific value, just defined.
In Visual Studio, go to Project Properties, drill down to C/C++ and then Preprocessor. Then find the preprocessor definitions line and click on the value. Now select edit and add _PSDK_BLD to the list of preprocessor definitions.
Watch out for that leading underscore, and remember to make the change for Debug and Release configurations (and for all the platforms you may have defined)
The error LNK2005 means that the linker found two definitions for the object it is trying to link - which is a problem because there's no way for the linker to be able to tell which of the two definitions it should use.
In this particular case, the object the linker is trying to resolve is "struct _GUID gProviderGuid". If you look in the files instlsp.h, lspdef.h (both of them) and lspcommon.h you'll see code that looks like this
extern GUID gProviderGuid;
That declares an external variable called gProviderGuid of type GUID (which is a struct). The linker has to resolve that external reference in any file that included one of those header files and then made a reference to gProviderGuid.
From the "already defined in lspguid.obj" part of the error we know the linker has looked inside the file lspguid.obj and found a definition of gProviderGuid. Sure enough, if we look inside lspguid.cpp we can see a definition of gProviderGuid with a value starting 0xc5fabbd0.
From the "C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\netds\winsock\lsp\instlsp.obj" part of the same error we know that the linker has also looked inside the file instlsp.obj and found a second definition of gProviderGuid. If we look inside intlsp.cpp we can see another definition of gProviderGuid (this time without any value).
The problem then is that the linker is looking in both lspguid.obj and intlsp.obj and finding conflicting definitions of gProviderGuid.
Those two files should not be part of the same build so we shouldn't expect a single run of the linker to read them both at the same time.
The LSP project is made up of four parts: lspcommon which is used to generate the static library lspcommon.lib; ifslsp which is used to generate the file ifslsp.dll; nonifslsp which is used to generate the file nonifslsp.dll and install which is used to generate the file Instlsp.exe. See the readme.txt file in lsp and the makefile files in the various folders for more details.
If you are going to build LSP inside Visual Studio, you really need four different projects in your solution, one each for lspcommon, ifslsp, nonifslsp and install.
Add this define to your build: _PSDK_BLD
It would solve your problem
Try changing #include <nt.h> to #include <winnt.h> and see if it builds.