无法使用任何外部库(Codeblocks)进行编译
Cannot compile using any external libraries (Codeblocks)
我无法在 Code::Blocks 上使用外部库编译任何代码。
我尝试使用 boost lambda 示例:
#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) << " " );
}
我为库设置了一个全局环境变量:
https://imgur.com/a/maiRC
...而且我认为我正确设置了构建选项。
https://imgur.com/a/BP0Xk
但是我的构建无法检测到头文件:
||=== Build: Debug in boost test (compiler: GNU GCC Compiler) ===|
C:\Documents and Settings\Charlotte\My Documents\wxTest\boost test\boo.cpp|1|fatal error: boost/lambda/lambda.hpp: No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
很遗憾,您的第一张图片中的 boost 包含路径被截断了。不过好像
C:\Boost\include\boost-1_62\boost
对吗?
这很可能是不正确的。如果你像以前一样包含 lambda header(这也是包含 boost Header 的常用方法)
#include <boost/lambda/lambda.hpp>
然后需要存在一个名为
的文件
C:\Boost\include\boost-1_62\boost\boost\lambda\lambda.hpp
这不符合正常的 Boost 目录布局。那里有一个 boost
太多了。尝试将您的全局环境 Boost 路径设置为:
C:\Boost\include\boost-1_62
我无法在 Code::Blocks 上使用外部库编译任何代码。
我尝试使用 boost lambda 示例:
#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) << " " );
}
我为库设置了一个全局环境变量: https://imgur.com/a/maiRC ...而且我认为我正确设置了构建选项。 https://imgur.com/a/BP0Xk
但是我的构建无法检测到头文件:
||=== Build: Debug in boost test (compiler: GNU GCC Compiler) ===|
C:\Documents and Settings\Charlotte\My Documents\wxTest\boost test\boo.cpp|1|fatal error: boost/lambda/lambda.hpp: No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
很遗憾,您的第一张图片中的 boost 包含路径被截断了。不过好像
C:\Boost\include\boost-1_62\boost
对吗?
这很可能是不正确的。如果你像以前一样包含 lambda header(这也是包含 boost Header 的常用方法)
#include <boost/lambda/lambda.hpp>
然后需要存在一个名为
的文件C:\Boost\include\boost-1_62\boost\boost\lambda\lambda.hpp
这不符合正常的 Boost 目录布局。那里有一个 boost
太多了。尝试将您的全局环境 Boost 路径设置为:
C:\Boost\include\boost-1_62