I downloaded sample code that uses a 'header only' library and even though I have included the library path in my VC++ project, I keep getting the error:
fatal error C1083: Cannot open include file: 'websocketpp/config/asio_no_tls.hpp': No such file or directory
Library header files location:
D:\websocketpp
D:\websocketpp\config
Here are the first few lines of the example program echo_server.cpp:
#include "stdafx.h"
#include <websocketpp/config/asio_no_tls.hpp>
#include <websocketpp/server.hpp>
The included files do exist in the directories above. I have specified the directories as follows:
Visual C++ Directories / Include Directories /
D:\websocketpp
C/C++ / General / Additional Include Directories
D:\websocketpp\config
Does someone know what the problem is?
It was a stupid mistake. I moved the entire directory structure into a new folder:
D:\websocket\websocket
D:\websocket\websocket\config
Related
I have created a simple Managed C++ project where I access CPoint from Atltypes.h. When compiling I am getting error 'errno.h' header not found. But I checked the project -> Properties -> VC++ Directories -> Include Directories... The header path is included.
The file errno.h is available in SDK path 'C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt'
But while compiling it is not able to pick it up. Is it due to any environment issue in my pc? Or is my visual studio settings corrupted?
After some more googling found that windows.h is key header which has all types. After adding below 2 headers in managed C++, it works fine
#include <Windows.h>
#include <msclr/marshal.h>
I have unit a.cpp that is used in several projects in subdirectory libA. Some of project are using precompiled headers, while others -not. In this case projects that use precompiled header must have line:
#include <stdafx.h>
and projects that are not using PCH must have line:
#include "..\stdafx.h"
Wise verse is not working.
Why project sees stdafx.h file in different way when project uses PCH or not?
UPD.
When I replace line #include <stdafx.h> with #include "..\stdafx.h" in project that uses precompiled header i have error
Error 19 error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
Directory structure is the same in both projects.
There is no (or there should not be any) difference between <stdafx.h> and "stdafx.h". The only significant difference is that one project "sees" the file in current folder, and the other project sees it in parent folder. This difference is controlled by compiler option Additional Include Directories. One project has libA in it, and the other does not have it.
I installed VS2012 today and started learning C++.
I wrote a Hello World program with #include <iostream.h>.
On build I get the error; C1083: Can not open include file... I believe this is an include path problem.
I tried editing the Include Directories in the VC++ Property Page but nothing I try works. Currently the include directories path has :
$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(WindowsSDK_IncludePath)
Any thoughts on how to fix?
It's not <iostream.h>, it's just <iostream>.
For standard c++ headers you must not put the .h so :
#include <iostream.h>
should become :
#include <iostream>
After that, if you are beginning with cplusplus, here is a link with the standard library headers (and articles about c++). It is a great help to have this website : http://www.cplusplus.com/reference/
I have dll project that includes additionally A.h header file. A.cpp includes A.h and B.cpp that has o header. If I do add B.cpp to visual c++ project compiler reports many errors :
Error 9 error LNK2005: "wchar_t * __stdcall aaa(int)" (?aaa##YGPA_WH#Z) already defined in A.obj C:\P\B.obj pr1
There are no problems and project compiles fine in case if I leave B.cpp in project directory, but not add it to project.
That is the problem with adding B.cpp file?
I thought that extensions has no influence and might be whatever you want. Correct me if I'm wrong, but I think I can rename B.h to B.fss , define this in source and compiler should compile
Your b.cpp will be automatically compiled if you include it in the project; and as you are including contents of the same file elsewhere as well, the code in it will be compiled again, resulting in duplicate definition errors
Basically if you include something that has definitions instead of declarations in one .cpp file and also add it to the project of course you will get multiple definition errors - move the definitions for the stuff in B.cpp to B.h and include that in A.cpp. The issue is not file extensions, the issue is that you need to understand that multiple definitions of the same thing will lead to such errors.
#include is for header files, not other .cpp files.
Remove #include "B.cpp" from A.cpp, and things will start behaving properly.
Or rename B.cpp to B.h if you intend to include it.
I am using Visual Studio 10 to program in C++
The 1st part of my program is
//Includes
//#include <LEDA\numbers> //fatal error C1083: Cannot open include file: 'LEDA\numbers': No such file or directory
#include <LEDA/numbers/real.h>
//Why do I get a linker error here
//All.obj : error LNK2001: unresolved external symbol "class leda::memory_manager leda::std_memory_mgr" (?std_memory_mgr#leda##3Vmemory_manager#1#A)
#include <LEDA\numbers\integer.h> //Here I used the system to write most of it for me
#include <LEDA/numbers/integer.h> //Include LEDA. So 2 things
//1. including the same file twice does not matter
//2. forward slashes and backward slashes are the same
//I tried to use a wild card and said #include <LEDA/numbers/*>
//But that did not work
#include <LEDA/numbers/rational.h>
#include <LEDA/core/string.h>
#include <LEDA/core/array.h>
#include <LEDA/numbers/bigfloat.h>
//The sqrt does not work
#include <iostream> //include ordinary C++
#include <math.h>
and I have a LINKER error
I have tried specifying which libraries to use by specifying the LIB User Environment symbol
I have tried specifying which libraries to use by specifying the
Include Directories and
Library Directories
in the properties of my Project
I have made a mistake somewhere, BUT where is it
There are several mistakes in this program:
LEDA\numbers is apparently a directory, not an include file. So you shouldn't try to include it.
(conceptual) #include statements don't help in resolving linker errors at all. Instead, you need to specify the libraries you want to link with to the linker; libraries are files that end in .lib. Go to the project settings, and add the libraries containing the missing symbols.
#include <abcd.h> // looks for the include abcd.h in the INCLUDES path.
#include "abcd.h" // looks for the include abcd.h in the current path and then INCLUDES path.
From your description it looks like your LEDA lib in under your current directory. Try using "" instead of <> and see if it fixes your errors.