编译一个简单的C ++程序

时间:2016-12-02 10:45:21

标签: c++ compiler-errors

所以基本上我正在尝试编译着名的Hello World程序来测试新的IDE和编译器。但它不会编译。

继承人的代码

// 'Hello World!' program

#include <iostream>

int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}

这是编译错误报告

ld: warning: ignoring file /Users/bencawley/Documents/Bens Projects/Atom Projects/Test Project A/Scripts/Script A, file was built for unsupported file format ( 0x2F 0x2F 0x20 0x27 0x48 0x65 0x6C 0x6C 0x6F 0x20 0x57 0x6F 0x72 0x6C 0x64 0x21 ) which is not the architecture being linked (x86_64): /Users/bencawley/Documents/Bens Projects/Atom Projects/Test Project A/Scripts/Script A
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我正在使用GCC / G ++来编译代码 我使用ATOM.io作为IDE

0 个答案:

没有答案