使用Conda构建环境的C ++ Hello World

时间:2017-09-01 16:02:38

标签: c++ anaconda conda

我正在设置一个共享的conda构建环境,以帮助我与同事协作。

我对conda相当新,之前只用它来进行python编程。但现在我也想将它用于c++项目。

我已经安装了已conda install -c gccgcc的{​​{1}}。我可以使用g++的输出验证这一点。

g++ --version

当我在康达环境之外这样做时,我得到了这个:

>g++ --version
g++ (GCC) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

所以我知道安装已经有效了。

我有这个问候世界代码:

>g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

尝试像这样编译:

#include <iostream>

int main()
{
    std::cout << "Hello world!" << std::endl;
}

但我收到此错误消息:

g++ main.cpp -o main

我怎样才能最好地解决这个问题?

0 个答案:

没有答案
相关问题