• ベストアンサー

Xcode8にしたらstdでエラーしました。

Xcodeを用いてアプリを作成しています。 いままで↓の様な関数を使っていたのですが、Xcodeを8にバージョンアップしたところ Apple Mach-O Linker (Id) Error が発生してしまいます。 void function(std::vector<int>& a); 解決方法がわかる方いましたら、よろしくお願いします。

質問者が選んだベストアンサー

  • ベストアンサー
回答No.1

そのコードは、C++のコードだと思いますが、自分が作ったコードですか? ライブラリ内部で発生しているのだったら、そもそもそのライブラリがXcode8に対応できているか疑うべきです。 もしエラーの原因がSwift3になったことによるものであれば、Use Legacy Swift Language VersionをYESにしてビルドすれば、Swiftのバージョンが2.3になるので、今までどおりビルドできるかもしれません。 (参考) http://qiita.com/Hakota/items/4a5e9201c7dc17e9017a

sugibayashi
質問者

お礼

回答ありがとうございます。 プロジェクトの設定がおかしくなっていたようで、一度プロジェクトを削除しsvnから落とし直したらエラーが発生しなくなりました。 お騒がせして申し訳ありません。

関連するQ&A

  • vectorを引数として使いたいのですがエラーが出てしまいます

    vectorを引数として使いたいのですがエラーが出てしまいます 以下のようなコードでコンパイルでエラーが出てしまうのですがどうしたら良いでしょうか。 class car{ public: int tire; int engine; } というクラスを作ります。 main関数内で function(car a[]);//関数の宣言 int main(){ std::vector<car> car1(0);//car型のcar1を作成 std::vector<car>::reference car1rf=car1.front(); function(car1rf);//関数に代入 } function(car a[]){ car test; test.tire=1; a.push_back(test); } としてpush_backを外部関数で行いたいのですが、エラーが出てしまいます。 どうしたら良いでしょうか。

  • Xcodeでのcのコンパイルエラーについて。

    Xcodeでc言語のコンパイル #include <stdio.h> int main(void) { printf("%d", 15 + 37); return(0); } をコンパイルすると ld: 2 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) となります。 いろいろ検索してみたのですが、こんな簡単なプログラムのエラーはのっていませんでした。 なにが問題なのでしょうか。 あと use -v ってのもどうやって使うのでしょうか。 よろしくおねがいします。

  • std::listの代入について

    最近std::listを勉強し始めたのですが質問があります。 あるクラスに以下を用意しました。 メンバ変数 std::list< int > list_int; メンバ関数 void SetListInt( const std::list< int > *temp_list ){ list_int = *temp_list; } 以下質問内容です。 ・この SetListInt 関数の場合 temp_list の先頭のみが代入されますか? ・また, temp_list の元の場所が削除または変更されても list_int の中身(この場合は先頭のみ?)は変わらないですよね? ・引数で貰って中身を全部代入したいならイテレータでfor文を回すしかないのでしょうか? 質問が多く拙文でお恥ずかしいのですが、よろしければご回答お願い致します。

  • macのXcodeにおけるcinについて

    現在macOSXver10.4.11のXcode2.4.1を用いて C++言語の勉強をしています。 以下のソースをコンパイルしようとしてますが「std::cin >> str1;」の行で「error: no match for 'operator>>' in 'std::cin >> str1;'」と出てコンパイルに失敗します。 原因が分かる方がいればご教授願います。 #include <iostream> #include <stdio.h> int main (void) { char *str1[32], *str2[32]; std::cout << "何か入力して下さい ==>"; std::cin >> str1; std::cout << "あなたは" << str1 << "と入力しましたね。" << std::endl; printf("何か入力してください。==>"); scanf("%s",str2); printf("あなたは、%sと入力しましたね。\n",str2); return 0; } 初歩的な質問ですみませんがご回答の程よろしくお願い致します。

  • vectorの中にmap

    vectorの中にmapを入れて 添字:ノードID [どのノードから来たのか|それまでのコスト] を表現しようと考えています. #include<iostream> #include<vector> #include<map> #include<list> // MACROS #define UNDEF -1 // PROTOTYPE DCLARE void init_path(std::vector<std::map<char, int> >, int size); int main(void) { //source -> source node // //size -> the number of node // //path -> store path infomation // ex: // path[1]: 1 is node id // char : from node id // cost : how cost from source to here // //adj -> show adjacency list eace node int source; int size; std::vector<std::map<char, int> > path; std::vector<std::list<char> > adj; size = 5; std::cout << "before" << std::endl; init_path(path, size); std::cout << "after" << std::endl; std::map<char, int>::iterator it; for(int i = 0; i < size; i++) { it = path[i].begin(); // std::cout << it->first << ":" << it->second << std::endl; } return 0; } void init_path(std::vector<std::map<char, int> > path, int size) { std::map<char, int> init; init.insert( std::map<char, int>::value_type('-', UNDEF) ); for(int i = 0; i < size ; i++) { path.push_back(init); } return; } *結果 before after Segmentation fault となり初期化をする所までは正常に動いたっぽいのですが どこが悪いのかわかりません(おそらくイテレータあたりかと思うのですが・・・・ 具体的にどうしたらいいのか分からないのでご指導ねがいます.

  • VC++のバグ?

    次のコードがコンパイルエラーとなってしまいます。 #include<vector> class foo:public std::vector<int>{ public: void clear(){ std::vector<int>::clear(); } }; VC6のSP2ではエラーになるんですが Linuxのgccでは全く問題なく動いたんです VC++のエラー?gccの拡張機能? .NETでは動くとか? どうなんでしょう? まあ、 using std::vector; や typedef std::vector<int> bar; とかすると回避可能なんですが…

  • Xcode4のエラー(IPhoneアプリ)

    はじめまして。 IPhoneのアプリ作成に挑戦しています。 Xcode4のバージョンは 4.5.1です。 【はじめてのXcode4プログラミング】という参考書でIPhoneのカメラアプリを作る章があり、写真ライブラリから選択した画像を表示できるとのことです。 しかし、XcodeでRun(実行)すると、ViewController.mの最後2行【UIImage *originalImage =[info objectForkey:UIImagePickerControllerOriginalImage];】が赤くなり、【’dismissModalViewControllerAnimated’is deprecated: first deprecated in iOS 6.0】というエラー表示がでます。 全体のコードは下記の通りです。 ネットで調べてみましたが、解決方法がわかりません。 先に進めず困っています。 どうか解決方法を教えてください。 よろしくお願い致します。 ●ViewController.h// // ViewController.h // CameraApp // #import @interface ViewController : UIViewController - (IBAction)pressCameraButton:(id)sender; @property (weak, nonatomic) IBOutlet UIImageView *imageView; @end ●ViewController.m // // ViewController.m // CameraApp // #import “ViewController.h” @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)pressCameraButton:(id)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewController:picker animated:YES]; } - (void)imagePickerController:(UIImagePickerController*)Picker didFinishPickingMediaWithInfo:(NSDictionary*)info { [self dismissModalViewControllerAnimated:YES]; UIImage *originalImage = [info objectForkey:UIImagePickerControllerOriginalImage]; self.imageView.image = originalImage; } @end

  • MavericksでXcode4.6.3が起動しな

    Mac-mini でiOSアプリの開発をしています。 先日まで10.8(Mountain Lion)で、Xcode4.6.3とXcode5.1.1の両方を使っていました。 Xcode4.6.3のほうを、/Applications/Xcode4.6.3.app という名前にすることで、使い分けが出来ていました。 先日10.9(Mavericks)にバージョンアップと、Xcode6-betaの試用を行なったところ、Xcode5.1.1のほうは問題なく起動するのですが、Xcode4.6.3が起動しなくなってしまいました。 起動時のプロジェクトを選択する画面が表示されるのですが、すぐにクラッシュしてしまいます。[レポート]をクリックしてクラッシュの内容を見てみると、 Error getting value for key 'delegateClass' of extension 'Xcode.IDEiPhoneOrganizer.MenuDefinition.Screenshots' in plug-in 'com.apple.dt.IDE.IDEiPhoneSupport' ということで、IDEiPhoneSupport.plugin が読み込めない状態になっているようです。 ターミナルで見てみると、クラッシュレポートの中に書かれているIDEiPhoneSupport.plugin のパスは確かに存在していますし、特に変わった様子はありませんでした。 IDEiPhoneSupport.plugin について検索したところ、iTunesがインストールされていなかったり、インストールする順番によっては、このエラーが発生することがあるということで、iTunesの再インストールが紹介されていました。iTunesHelperを終了させてから、 cd /Applications sudo rm -rf iTunes.app でiTunesを削除して、最新のdmgをダウンロードしてインストールしましたが、状況は変わりませんでした。 あと、プリファレンスのパスが分かったので、下記の4つを削除してみました、それでも変わりませんでした。 ~/Library/Preferences/com.apple.Xcode.plist ~/Library/Preferences/com.apple.dt.Xcode.plist ~/Library/Caches/com.apple.dt.Xcode/ ~/Library/Saved Application State/com.apple.dt.Xcode.savedstate/ あと、既存のXcode4.6.3を削除して、DevCenterからダウンロードし直したものをインストールしてみましたが、変わりませんでした。 ググった限りでは、MavericksでXcode4.6.3が使えないという情報は無かったので、何かを直せば起動するのではないかと思っているのですが、どうにも起動しないので困っています。何か情報はありますでしょうか。 なお、クラッシュレポートのヘッダ部分は下記の通りです。 Process: Xcode [1760] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 4.6.3 (2068) Build Info: IDEApplication-2068000000000000~3 Code Type: X86-64 (Native) Parent Process: launchd [165] Responsible: Xcode [1760] User ID: 501 Date/Time: 2014-06-13 17:08:14.670 +0900 OS Version: Mac OS X 10.9.3 (13D65) Report Version: 11 Anonymous UUID: 333506D4-41D3-A4B4-9DCC-AF9726BED13D Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Application Specific Information: ProductBuildVersion: 4H1503 UNCAUGHT EXCEPTION (NSInternalInconsistencyException): Error getting value for key 'delegateClass' of extension 'Xcode.IDEiPhoneOrganizer.MenuDefinition.Screenshots' in plug-in 'com.apple.dt.IDE.IDEiPhoneSupport' UserInfo: { NSUnderlyingError = "Error Domain=DVTPlugInErrorDomain Code=2 \"Loading a plug-in failed.\" UserInfo=0x4015ffe60 {DVTPlugInIdentifierErrorKey=com.apple.dt.IDE.IDEiPhoneSupport, DVTPlugInExecutablePathErrorKey=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/IDEiPhoneSupport.ideplugin/Contents/MacOS/IDEiPhoneSupport, NSLocalizedRecoverySuggestion=The plug-in or one of its prerequisite plug-ins may be missing or damaged and may need to be reinstalled., NSLocalizedDescription=Loading a plug-in failed., NSFilePath=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/IDEiPhoneSupport.ideplugin, NSLocalizedFailureReason=The plug-in \U201ccom.apple.dt.IDE.IDEiPhoneSupport\U201d at path \U201c/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/PrivatePlugIns/IDEiPhoneSupport.ideplugin\U201d could not be loaded. The plug-in or one of its prerequisite plug-ins may be missing or damaged., NSUnderlyingError=0x4002a1a20 \"The bundle \U201cIDEiPhoneSupport\U201d couldn\U2019t be loaded because it is damaged or missing necessary resources.\"}"; } Hints: None

  • gcc lcrt1.o コンパイルエラー mac xcode

    Mac OS X 10.3.9のXcode 300.0上で、UNIX上で動作するC言語プログラムの開発を行っています。 デバッガ上で、エラーや警告が最後まで、一つだけ消えずに、コンパイルできません。デバッガ上のエラーは「control reaches end of non-void function」、ターミナル上から、gccでコンパイルすると、「can't locate file for: -lcrt1.o」というエラーです。 解決法をご教示ください。

  • コンパイルすると error C1083 が出てしまいます

     -スペック- Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM Microsoft .NET Framework Version 3.5 SP1 ---------------------------------------------------------------- 以下のプログラムを実行すると、error C1083: include ファイルを開けません。'myhelper.h': No such file or directory っていうエラーが出ます。 ----------------------------------------------------------------  -プログラム-  - mymain.cpp の中身 - #include "myhelper.h" #include "mymain.h" //自キャラのデータ Point2D g_jikipos = {40, 400}; //自キャラの座標 //画像ハンドル int g_jikiimage[11]; //色々なファイルの読み込み int LoadFiles(){ //画像ファイル読み込み if(LoadDivGraph("media\\player01.bmp", 11,11,1,64,64,g_jikiimage) == -1) return -1; return 1; }  - mymain.h の中身 - //他から呼び出させるMyMainの関数 void MyMain(); int LoadFiles();  - myhelper.h の中身 - #include "DxLib.h" #include <limits.h> #include <math.h> //構造体宣言 //座標またはベクトルを記録する構造体 struct Vector{ float x,y; }; typedef Vector Point2D; //線を記録する構造体 struct Line2D{ Point2D startpos, endpos; float katamuki; //傾きをラジアン値で記録 Vector speed; //移動している場合は速度をセット }; //球体を記録する構造体 struct Ball2D{ Point2D position; float hankei; //半径 }; //四角形を記録する構造体 struct Rect2D{ Point2D lefttop; Point2D rightbottom; float width; float height; }; //ライブラリ関数 Point2D PosInView(Point2D in); int XInView(float inx); int YInView(float iny); void ScrollToLeft(float jikiposx); void ScrollToRight(float jikiposx); void ScrollToUp(float jikiposy); void ScrollToDown(float jikiposy); void DrawLineInView(float x1, float y1, float x2, float y2, int Color, int Thickness); void DrawCircleInView(float x, float y, float r, int Color, int FillFlag); void DrawAnimation(float x, float y, double ExtRate, double Angle,int TurnFlag, int *imgarray, int allframe, float fps); //ベクトル関数 Vector CreateVector(Vector in, float veclen); Vector AddVector(Vector v1, Vector v2); Vector SubVector(Vector v1, Vector v2); Vector AddVectorInFrameTime(Vector pos, Vector speed); Vector AddVectorInFrameTime2(Vector pos, Vector speed, Vector accel); Vector Normalize(Vector in); Vector RotateVector(Vector in, float radian); float VectorLengthSquare(Vector in); float DotProduct(Vector v1, Vector v2); float CrossProduct(Vector v1, Vector v2); void SetLine2DKatamuki(Line2D *in); void DrawLine2D(Line2D in, int Color, int Thickness); void DrawBall2D(Ball2D in, int Color, int Fill); //当たり判定関数 bool HitTestLineAndBall(Line2D linein, Ball2D ballin); bool IsPointAtLineFace(Line2D linein, Point2D ptin); bool HitTestLineAndLine(Line2D line1, Line2D line2); bool HitTestBallAndBall(Ball2D a, Ball2D b); bool HitTestPointAndBox(Rect2D rect, Point2D pt); //タイマー関数 void SetSimpleTimer(int idx, int time); int GetPassedTime(int idx); //グローバル変数 extern float g_frametime; extern Rect2D g_framerect; //画面領域(当たり判定) extern Point2D g_current_field_pos; //現在の左上座標 extern Rect2D g_stagesize; //ステージサイズ //定数宣言 const float ZEROVALUE = 1e-10f; const float PIE = 3.1415926f; const int SCROLL_LIMIT = 200; myhelper.h はコピペなので間違ってはない。 ---------------------------------------------------------------- まだC言語初心者なので、どのようにすれば直せるのかわからないので 詳しくお願いします。 一応サイトで検索などをして、自分なりに調べてきて 定義が間違ってないかを見ましたけどそれでもまだわかりません。 それでは宜しくお願いします。

専門家に質問してみよう