在尝试查看我在系统上使用的gcc版本时,我收到了以下消息
gcc --version
gcc: warning: couldn’t understand kern.osversion ‘14.5.0
gcc (GCC) 4.9.0
Copyright (C) 2014 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
which -a gcc
/usr/local/bin/gcc
/usr/local/bin/gcc
/usr/bin/gcc
然后我尝试使用一些代码尝试Xcode和Sublime文本,并在尝试构建时遇到更多错误。
on sublime text:
#include <stdio.h>
int main (void)
{
/*Define variables*/
float num1, num2, num3, media;
printf("Insert some number:");
scanf("%f",&num1);
}
Xcode上的错误消息:clang:错误:没有输入文件[在0.9s内完成 退出代码1]
:
#include <stdio.h>
int main ()
{
int num;
printf("Write a number:");
scanf("%d",&num);
getchar();
}
错误消息:架构x86_64链接器的2个重复符号 命令失败,退出代码为1
ld /Users/*****/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqrpzzfdaav/Build/Products/Debug/C++\
Programming normal x86_64
cd "/Users/*****/Desktop/C++/C++ Programming"
export MACOSX_DEPLOYMENT_TARGET=10.10
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
-L/Users/*******/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqrpzzfdaa/Build/Products/Debug
-F/Users/******/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqrpzzfda/Build/Products/Debug
-filelist /Users/****/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqr/Build/Intermediates/C++\
Programming.build/Debug/C++\
Programming.build/Objects-normal/x86_64/C++\ Programming.LinkFileList
-mmacosx-version-min=10.10 -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/****/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqrpzzf/Build/Intermediates/C++\
Programming.build/Debug/C++\
Programming.build/Objects-normal/x86_64/C++\
Programming_dependency_info.dat -o
/Users/***/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqrpzzfdBuild/Products/Debug/C++\
Programming
重复符号_main: /用户/ ******* /库/开发商/ Xcode中/ DerivedData / C ++编程_-gsftvvhqrpzz /编译/中间体/ C ++ Programming.build/Debug/C++ Programming.build/Objects-normal/x86_64/Add.o /用户/ ****** /库/开发商/ Xcode中/ DerivedData / C ++编程_-gsftvvhqrpz /编译/中间体/ C ++ Programming.build/Debug/C++ Programming.build/Objects-normal/x86_64/main.o复制符号_main 在: /用户/ ***** /库/开发商/ Xcode中/ DerivedData / C ++编程_-gsftvvhqr /编译/中间体/ C ++ Programming.build/Debug/C++ Programming.build/Objects-normal/x86_64/Add.o /用户/ ****** /库/开发商/ Xcode中/ DerivedData / C ++编程_-gsftvvhqrpzz /编译/中间体/ C ++ Programming.build/Debug/C++ Programming.build/Objects-normal/x86_64/C++.o ld:2个重复的符号 对于体系结构x86_64 clang:错误:链接器命令因退出而失败 代码1(使用-v查看调用)
有关如何解决此错误的任何建议
由于