該当のソースコード
C++
1extern int* pwritten; 2extern uint8_t* pdata; 3extern int* ppause; 4 5extern double* psteerCmd_ghost; 6extern double* paccelCmd_ghost; 7extern double* pbrakeCmd_ghost; 8 9extern double* pspeed_ghost; 10extern double* ptoMiddle_ghost; 11extern double* pangle_ghost; 12 13extern double* pfast_ghost; 14 15extern double* pdist_L_ghost; 16extern double* pdist_R_ghost; 17 18extern double* ptoMarking_L_ghost; 19extern double* ptoMarking_M_ghost; 20extern double* ptoMarking_R_ghost; 21 22extern double* pdist_LL_ghost; 23extern double* pdist_MM_ghost; 24extern double* pdist_RR_ghost; 25 26extern double* ptoMarking_LL_ghost; 27extern double* ptoMarking_ML_ghost; 28extern double* ptoMarking_MR_ghost; 29extern double* ptoMarking_RR_ghost; 30 31////// 32double* psteerCmd=NULL; 33double* paccelCmd=NULL; 34double* pbrakeCmd=NULL; 35 36double* pspeed=NULL; 37double* ptoMiddle=NULL; 38double* pangle=NULL; 39 40double* pfast=NULL; 41 42double* pdist_L=NULL; 43double* pdist_R=NULL; 44 45double* ptoMarking_L=NULL; 46double* ptoMarking_M=NULL; 47double* ptoMarking_R=NULL; 48 49double* pdist_LL=NULL; 50double* pdist_MM=NULL; 51double* pdist_RR=NULL; 52 53double* ptoMarking_LL=NULL; 54double* ptoMarking_ML=NULL; 55double* ptoMarking_MR=NULL; 56double* ptoMarking_RR=NULL; 57////// 58 59int count=0; 60/////////////////////////////// by Chenyi 61 62static void 63ReOneStep(double deltaTimeIncrement) 64{ 65/////////////////////////// by Chenyi 66 if (psteerCmd==NULL) { 67 psteerCmd=psteerCmd_ghost; 68 paccelCmd=paccelCmd_ghost; 69 pbrakeCmd=pbrakeCmd_ghost; 70 71 pspeed=pspeed_ghost; 72 ptoMiddle=ptoMiddle_ghost; 73 pangle=pangle_ghost; 74 75 pfast=pfast_ghost; 76 77 pdist_L=pdist_L_ghost; 78 pdist_R=pdist_R_ghost; 79 80 ptoMarking_L=ptoMarking_L_ghost; 81 ptoMarking_M=ptoMarking_M_ghost; 82 ptoMarking_R=ptoMarking_R_ghost; 83 84 pdist_LL=pdist_LL_ghost; 85 pdist_MM=pdist_MM_ghost; 86 pdist_RR=pdist_RR_ghost; 87 88 ptoMarking_LL=ptoMarking_LL_ghost; 89 ptoMarking_ML=ptoMarking_ML_ghost; 90 ptoMarking_MR=ptoMarking_MR_ghost; 91 ptoMarking_RR=ptoMarking_RR_ghost; 92 } 93/////////////////////////// by Chenyi 94 95/////////////////////////// by Chenyi, output 1 image per 0.1 second 96 if (*ppause == 1) 97 { 98 count++; 99 if (count>50) 100 { 101 count=1; 102 103 glReadPixels(0, 0, image_width, image_height, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)pdata); 104 *pwritten=1; 105 106 while (*pwritten == 1) 107 usleep(1); 108 109 double t = GfTimeClock(); 110 if ((t - ReInfo->_reCurTime) > 30*RCM_MAX_DT_SIMU) 111 ReInfo->_reCurTime = t - RCM_MAX_DT_SIMU; 112 } 113 }
発生している問題・エラーメッセージ
torcsというオープンソースコードのカーシュミレーションソフトのプロジェクトファイルをコンパイルしたいと考えています. そこで,Visual studio 2017においてビルドを行うとエラーが発生してしまいます. 2000行程あり,全てのコードを載せることはできませんが,上記の while (*pwritten == 1) usleep(1); の部分で以下のエラーが発生しています. 対策としてどのようなことが考えられるでしょうか. 宜しくお願い致します. 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態 エラー C3861 'usleep': 識別子が見つかりませんでした client c:\users\owner\desktop\deepdrivingcode_v2\deepdriving\torcs-1.3.6\src\libs\raceengineclient\raceengine.cpp 721
usleep() はLinuxとかですが?Windowsにunistd.hって有りますか?1μ秒停止って??しかも非推奨→http://manpages.ubuntu.com/manpages/bionic/ja/man3/usleep.3.html
回答ありがとうございます.
検索をかけると,unistd.hファイルは存在しました.
こちらのファイルをインクルード指定しているディレクトリにコピーしましたが,エラーは消えません.
http://deepdriving.cs.princeton.edu/
このサイトにあるソースコードをコンパイルしたいのですが,Linuxでないとダメといったことがあるのでしょうか.
TORCSがVS6.0またはVS2008しかWindows環境でのコンパイルをサポートしていない(テストしていない)ということを知っている上でVS2017を使用しているのですか?
http://torcs.sourceforge.net/index.php?name=Sections&op=viewarticle&artid=3#linux-src-all-win
一応、VS2017でもうまくいったという人もいるようですが、下記の内容を理解できるぐらいの技術力が無いとかなり厳しいですよ。
http://www.berniw.org/trb/forum/showthread.php?topicid=5521
回答1件
あなたの回答
tips
プレビュー