更新到Sierra之后,我将我的Xcode从7.2.1更新为Xcode 8.因此,只需更新Xcode就可能出现问题.我降级回到7.2.1但仍然遇到了同样的问题.
这是我在编译C++程序时遇到的错误
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:4:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:4:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:54:11: warning: section "__textcoal_nt" is deprecated
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
^ ~~~~~~~~~~~~~
/var/folders/cj/1h3_84h56c9bgzt_ryhpf4940000gn/T//ccgjxtCM.s:54:11: note: change section name to "__text"
.section __TEXT,__textcoal_nt,coalesced,pure_instructions
Run Code Online (Sandbox Code Playgroud)
程序仍在运行,但会显示此消息.即使代码中唯一的东西是我创建的类称为图形,并且我有这样的代码,也会出现错误.
void explore(Graph & G, int x)
{
Node* nodePtr = &G.changeNode(x);
}
Run Code Online (Sandbox Code Playgroud)
我尝试在命令行中执行此操作,但它无法正常工作
sudo xcode-select -s /Library/Developer/CommandLineTools
Run Code Online (Sandbox Code Playgroud)
这是我在Sublime Text中使用的构建,但即使使用不是c ++ 11的其他c ++编译器,我也会得到相同的错误.命令行上也出现错误.
{
"shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, …Run Code Online (Sandbox Code Playgroud) 是否可以将foo从float转换为long(反之亦然)?
auto foo = float(1234567891234.1234);
cout << "foo: " << foo << endl;
foo = long(1234567891234.1234);
cout << "foo: " << foo << endl;
Run Code Online (Sandbox Code Playgroud)
输出总是:
foo: 1.23457e+12 foo: 1.23457e+12
C++.是否有可能做到这一点?
if (x>3)
int foo=10
else
long foo=10
Run Code Online (Sandbox Code Playgroud)
没有得到错误:
在这方面没有申明
c++ ×3
c++11 ×2
auto ×1
casting ×1
declaration ×1
if-statement ×1
macos ×1
variables ×1
xcode ×1