编辑2:问题不是一个简单的印刷错误.我在下面的日志中写了一个错字,我纠正了,但问题仍然存在.
编辑:在尝试下面之后,我错误地用gcc而不是g ++运行了一次.之前使用g ++存在问题,它现在存在.
我目前正在使用MacOS High Sierra盒子.我最近把很多文件从MacBook Air移到了这台机器上,包括我认为是Xcode的所有垃圾.现在,当我尝试编译一个非常简单的C++程序时:
#include <iostream>
int main()
{
// VAR_DEC
int a = 4;
// VAR_MANIP
a = a*2;
// VAR_PRINT
std::cout << a << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我得到以下荒谬的错误:
jrfarah@Josephs-MBP: [config_file_script] $ g++ test.cpp -o test
In file included from test.cpp:1:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iostream:38:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__locale:15:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string:470:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string_view:171:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/__string:56:
In …Run Code Online (Sandbox Code Playgroud) 我在用:
clang -ObjC -framework UIKit -o /var/compiled/c /Documents/Source/main.m
在 OS X 终端中。我也试过 UIKit.framework,但我得到
致命错误:找不到“UIKit/UIKit.h”
既。
有什么建议?
谢谢