Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn’t understand kern.osversion ‘14.5.0

Tags:

c++

xcode

macos

gcc

While trying to see what gcc version I had on the system I got the following message

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

Then I tried Xcode and Sublime text with some code and got more errors while trying to build.

on sublime text:

#include <stdio.h>

int main (void)

{

/*Define variables*/

float num1, num2, num3, media;

printf("Insert some number:");

scanf("%f",&num1);

}

error message: clang: error: no input files [Finished in 0.9s with exit code 1]

on Xcode:

#include <stdio.h>

int main ()

{

int num;

printf("Write a number:");

scanf("%d",&num);

getchar();

}

error message: 2 duplicate symbols for architecture x86_64 Linker command failed with exit code 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

duplicate symbol _main in: /Users/*******/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqrpzz/Build/Intermediates/C++ Programming.build/Debug/C++ Programming.build/Objects-normal/x86_64/Add.o /Users/******/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqrpz/Build/Intermediates/C++ Programming.build/Debug/C++ Programming.build/Objects-normal/x86_64/main.o duplicate symbol _main in: /Users/*****/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqr/Build/Intermediates/C++ Programming.build/Debug/C++ Programming.build/Objects-normal/x86_64/Add.o /Users/******/Library/Developer/Xcode/DerivedData/C++_Programming-gsftvvhqrpzz/Build/Intermediates/C++ Programming.build/Debug/C++ Programming.build/Objects-normal/x86_64/C++.o ld: 2 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any suggestions on how to fix this error

Thanks

like image 831
user5296120 Avatar asked Sep 03 '15 10:09

user5296120


1 Answers

You might would have upgraded your system. Since gcc isn't installed by default, an OS upgrade probably didn't remove or replace gcc and other XCode command line tools.

You can obviously rename them (or move them in a backup subdirectory), so that they are out of your PATH. That way, homebrew will not find them and use the newer compiler (clang). Very likely, your system (XCode, brew) will continue as usual, since they'll use the clang found on your system.

The error you see, "couldn't understand kern.osversion '14.5.0'", is probably from the fact that this gcc was compiled against an older OS X kernel version, and the current one is backwards incompatible with that.

like image 85
Rajnish Avatar answered Nov 14 '22 07:11

Rajnish