Include Boost file gets file not found error - c++

I'm trying to get boost running so that I can use a C library as an external library for my python program. But I keep getting the file not found error when including header files.
I'm following the tutorial on Boost's website: https://www.boost.org/doc/libs/1_76_0/more/getting_started/windows.html
I've downloaded boost and extract it to my C disk. Added its directory (C:\Program Files\boost_1_76_0) to the include path in vscode using Microsoft C/C++ extension
However, when I tried to follow this example from the tutorial above:
(There were no python codes involved yet just C++)
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
I get the error "fatal error: boost/lambda/lambda.hpp: No such file or directory
#include <boost/lambda/lambda.hpp>" even though the file exists.

Related

include <Eigen/Dense> succeed, include <Eigen> failed

My question is similar to this 5 years old question.
I can successfully compile it if I use the following code:
#include <Eigen/Dense>
#include <iostream>
//#include <boost/serialization/array_wrapper.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
int main(){
std::cout<<"asfserea"<<std::endl;
boost::gregorian::date d(boost::gregorian::day_clock::local_day());
std::cout << d.year() << d.month() <<d.day() << std::endl;
return 0;
}
But I got errors after I changed annotation from #include <Eigen/Dense> to #include <Eigen>, from #include <boost/date_time...> to #include <boost/serialization...>:
File you are looking for is <Eigen/Eigen>. If you want to include <Eigen>, you should add correct folder to your include path.
For array_wrapper.hpp, you need newer version of Boost. At least version 1.67.0 has this file.
When you #include <Eigen>, your compiler looks at the directories that you have told it about, for a file named Eigen. It only finds a folder named Eigen, and within that folder there are files Eigen and Dense. It does not look inside that folder.
If you change your compilers parameters to include the Eigen folder (rather than it's parent), you can #include <Eigen> and #include <Dense>. Alternatively, you can keep your include directories as they are, and prepend Eigen/ to all the Eigen includes

Cant use boost in xCode

When I am trying to use the boost library in xCode, i keep getting an error.
I have linked the header and link library like the tutorials say, but i am still getting an error
> #include <iostream>
> #include <string> // std::string
> #include <sstream> // std::stringstream
> #include <initializer_list>
> #include <vector>
> #include <boost/type_index.hpp>
> using std::cout;
> using std::endl;
at the boost index, my compiler says "'boost/type_index.hpp' file not found" when I try building..
How do i fix this?
In your Xcode project build settings, you must ensure you find/choose it in the the header search paths. (eg /usr/local/boost_1_60_0/include/)

Visual Studio cannot open source file inspite of setup

I'm running VS2015 on Windows 10 and I'm having issues with include directories. I have setup the Additional Include Directories in C/C++ -> General and Include Directories in VC++ Directories to point to the right path (F:\boost_1_61_0). I keep getting the "Cannot open source file" error. If I move the cursor to the include statement the full include path in the Definition bar points to the correct address. This also happens when working with Google Mock. All the core and STL includes work just fine.
I've stripped down the code to try and just get it to work on this basic Boost test code:
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
I've successfully built this code using Netbeans by adding the additional include directory to the project without any issues, so its not a file access issue. The compiler used from Netbeans was G++, but from VS I used MSVC and tried ICP with the same results.
Thanks,
As The Dark states above: make sure you check that the build properties match.

fatal error C1083 during build of program to test CStrings

I am trying to explore the CString Data type which is used extensively in my company's test program.
Here is the code:
#include <iostream>
#include <string>
#include <afx.h>
using namespace std;
int main()
{
CString cs("meow");
wcout << cs << endl;
return 0;
}
The above code compiles with 0 errors. However, when I try to build it, I get the following error.
fatal error C1083: Cannot open include file: 'atlstr': No such file or directory
I am using Visual C++ 6 Standard Edition for development.
Please note that my company's test program can compile and run well and I don't get the aforementioned error.
Is there a place where I can download the atlstr include file?

g++, Xerces 3.1, "memcpy was not declared in this scope"

In my makefile on this project, I am specifying 3 location for the compiler to find #includes.
INCLUDES=-I. -I/home/kelly/xerces/xerces-c-3.1.1/src -I/home/kelly/Utilities_New
When I compile the following sample code with the command line found in the comment:
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <xercesc/util/XMLString.hpp>
using namespace std;
/*
g++ -I. -I/home/kelly/xerces/xerces-c-3.1.1/src -I/home/kelly/Utilities_New test.cpp
*/
int main(int argc, char* argv[])
{
cout << "this works" << endl;
}
In file included from /home/kelly/Utilities_New/string.h:5:0,
from /home/kelly/xerces/xerces-c-3.1.1/src/xercesc/framework/XMLBuffer.hpp:28,
from /home/kelly/xerces/xerces-c-3.1.1/src/xercesc/util/XMLString.hpp:26,
from test.cpp:7:
/home/kelly/Utilities_New/defs.h:26:21: fatal error: windows.h: No such file or directory
compilation terminated.
Clearly the compiler has decided that when it processes the Xerces #includes and finds string.h in the Utilities_New directory, it has found what it needs and stops there.
This other string.h was written by another programmer and I am attempting to use his library.
I thought that the standard locations were searched first. I'm a little lost here. I may be missing something super obvious to you all.
Also, wasn't there some rule about #include files that had <> vs. "" around them and where the compiler was supposed to look?
The standard locations are searched last.
#include "blah" is identical to #include <blah> unless blah is found in the same directory as the file that tries to include it. (And unless you use the rare and gcc-specific -iquote option).
For more information see here.