質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Visual Studio

Microsoft Visual StudioはMicrosoftによる統合開発環境(IDE)です。多種多様なプログラミング言語に対応しています。

C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

Q&A

解決済

1回答

11880閲覧

Visual studioにおけるエラーについて

muton

総合スコア31

Visual Studio

Microsoft Visual StudioはMicrosoftによる統合開発環境(IDE)です。多種多様なプログラミング言語に対応しています。

C++

C++はC言語をもとにしてつくられた最もよく使われるマルチパラダイムプログラミング言語の1つです。オブジェクト指向、ジェネリック、命令型など広く対応しており、多目的に使用されています。

0グッド

0クリップ

投稿2018/12/04 09:35

編集2018/12/05 07:00

発生している問題・エラーメッセージ

以下のようなエラーが多数表示されるのですが,どうすれば良いか分かる方いますでしょうか. エラー (アクティブ) E0109 呼び出しのかっこの前の式は、関数型 (または pointer-to-function 型) である必要があります

該当のソースコード

C++

1/*************************************************************************** 2 3 file : ac3dgroup.cpp 4 created : Fri Apr 18 23:11:36 CEST 2003 5 copyright : (C) 2003 by Christophe Guionneau 6 version : $Id: ac3dgroup.cpp,v 1.6.2.9 2012/09/10 05:10:26 berniw Exp $ 7 8 ***************************************************************************/ 9 10/** @file 11 12 @author Christophe Guionneau 13 @version $Id: ac3dgroup.cpp,v 1.6.2.9 2012/09/10 05:10:26 berniw Exp $ 14*/ 15 16#include <stdio.h> 17#include <stdlib.h> 18#include <ctype.h> 19#include <cstring> 20#ifndef _GNU_SOURCE 21#define _GNU_SOURCE 22#endif 23#include <math.h> 24#ifdef WIN32 25#include <windows.h> 26#endif 27#include "accc.h" 28 29double strnicmp, strcmp, stricmp, stderr, sqrt, printf, malloc, fprintf, fopen, fabs, exit, atoi; 30 31extern int printOb(ob_t *ob); 32extern mat_t *root_material; 33extern void smoothTriNorm(ob_t *object ); 34void reorder(ob_t *ob,ob_t *ob2, double *textarray,tcoord_t *vertexarray); 35 36 37 38 39void assignArrays(ob_t *tmpob, ob_t* tmpob2, double **textarray, tcoord_t **vertexarray, char **texture) 40{ 41 while (tmpob2!=NULL) { 42 if (tmpob2->name==NULL) { 43 tmpob2=tmpob2->next; 44 continue; 45 } 46 if (!strcmp(tmpob2->name, "root")) { 47 tmpob2=tmpob2->next; 48 continue; 49 } 50 if (!strcmp(tmpob2->name, "world")) { 51 tmpob2=tmpob2->next; 52 continue; 53 } 54 if (tmpob->type!=NULL) { 55 if (!strcmp(tmpob->type,"group")) { 56 tmpob2=tmpob2->next; 57 continue; 58 } 59 } 60 61 int notinsameorder=FALSE; 62 if (!stricmp(tmpob2->name, tmpob->name) && tmpob->numvert==tmpob2->numvert) { 63 /* found an ob in ob1 */ 64 *texture=tmpob2->texture; 65 *textarray=tmpob2->textarray; 66 *vertexarray=tmpob2->vertexarray; 67 for (int i=0; i<tmpob->numvert; i++) 68 if ( 69 fabs(tmpob->vertex[i].x - tmpob2->vertex[i].x )>MINVAL || 70 fabs(tmpob->vertex[i].y - tmpob2->vertex[i].y )>MINVAL || 71 fabs(tmpob->vertex[i].z - tmpob2->vertex[i].z )>MINVAL ) 72 { 73 notinsameorder=TRUE; 74 } 75 if (notinsameorder==TRUE) { 76 printf("%s : points not in the same order, reordering ...\n",tmpob->name); 77 reorder(tmpob,tmpob2,*textarray,*vertexarray); 78 printf("%s : reordering ... done\n",tmpob->name); 79 } 80 break; 81        } 82 return; 83} 84 85

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

double strnicmp, strcmp, stricmp, stderr, sqrt, printf, malloc, fprintf, fopen, fabs, exit, atoi;

これは何をしてるのでしょう。
標準関数と同名のdouble変数を定義してるようですが。

投稿2018/12/04 09:43

y_waiwai

総合スコア87749

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

muton

2018/12/04 09:53

回答ありがとうございます. torcsというオープンコードのカーシュミレーションソフトのプログラミングを操作したいと考えています. 何分素人なもので,このような標準関数を定義する場合はどのように定義すれば良いのかご教授お願いしたいです.
y_waiwai

2018/12/04 10:01

標準関数はそれぞれ決まったヘッダファイルがあり、それをインクルードすればそれで使えるようになります。 この場合は、 #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <cstring> がそれに当たります。 それ以外には何もする必要はありません
muton

2018/12/04 10:20

ありがとうございます. double strnicmp, strcmp, stricmp, stderr, sqrt, printf, malloc, fprintf, fopen, fabs, exit, atoi; の部分を消去すると, エラー (アクティブ) E0020 識別子 "atoi" が定義されていません というエラーが発生してしまうのですが,どうすればよいでしょうか.
y_waiwai

2018/12/04 10:27

どの行でエラーがでるのでしょうか。 エラーが出ている行を見て、なにかおかしいものがないかを見てみればどうでしょう
muton

2018/12/04 10:41

エラー (アクティブ) E0020 識別子 "strcmp" が定義されていません 以下の行で上記の様なエラーが発生します. if (!strcmp(tmpob2->name, "root")) { doubleではなく,何か別の方法を用いて定義するべきなのでしょうか.
y_waiwai

2018/12/04 10:57

「C言語 strcmp」でぐぐると、その関数の定義の説明が出てきます それでみると、ヘッダファイルはstring.h であることがわかります。 そういうことで、 #include <string.h> を追加しましょう
muton

2018/12/04 11:16

#include <string.h> を追加すると以下のエラーが発生します. エラー (アクティブ) E1696 ソース ファイルを開けません "strcmp.h" よろしくお願いいたします.
y_waiwai

2018/12/04 11:21

繰り返しますが、どこの行でそのエラーが出るんでしょうか。どのファイルの何行目でしょうか
muton

2018/12/04 11:29

ありがとうございます. 以下のstrcmpを含む全ての行でエラーが生じます. while (tmpob2!=NULL) { if (tmpob2->name==NULL) { tmpob2=tmpob2->next; continue; } if (!strcmp(tmpob2->name, "root")) { tmpob2=tmpob2->next; continue; } if (!strcmp(tmpob2->name, "world")) { tmpob2=tmpob2->next; continue; } if (tmpob->type!=NULL) { if (!strcmp(tmpob->type,"group")) { tmpob2=tmpob2->next; continue; }
y_waiwai

2018/12/04 11:58

こちらではそうなりません。 そちらのコードになにか間違いがありますねー 現状のコードを、質問に追記してみてください
muton

2018/12/05 07:03

#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <cstring> #include <strcmp.h> #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <math.h> #ifdef WIN32 #include <windows.h> #endif #include "accc.h" extern int printOb(ob_t *ob); extern mat_t *root_material; extern void smoothTriNorm(ob_t *object ); void reorder(ob_t *ob,ob_t *ob2, double *textarray,tcoord_t *vertexarray); void assignArrays(ob_t *tmpob, ob_t* tmpob2, double **textarray, tcoord_t **vertexarray, char **texture) { while (tmpob2!=NULL) { if (tmpob2->name==NULL) { tmpob2=tmpob2->next; continue; } if (!strcmp(tmpob2->name, "root")) { tmpob2=tmpob2->next; continue; } if (!strcmp(tmpob2->name, "world")) { tmpob2=tmpob2->next; continue; } if (tmpob->type!=NULL) { if (!strcmp(tmpob->type,"group")) { tmpob2=tmpob2->next; continue; } } int notinsameorder=FALSE; if (!stricmp(tmpob2->name, tmpob->name) && tmpob->numvert == tmpob2->numvert) { /* found an ob in ob1 */ *texture = tmpob2->texture; *textarray = tmpob2->textarray; *vertexarray = tmpob2->vertexarray; for (int i = 0; i < tmpob->numvert; i++) if ( fabs(tmpob->vertex[i].x - tmpob2->vertex[i].x) > MINVAL || fabs(tmpob->vertex[i].y - tmpob2->vertex[i].y) > MINVAL || fabs(tmpob->vertex[i].z - tmpob2->vertex[i].z) > MINVAL) { notinsameorder = TRUE; } if (notinsameorder == TRUE) { printf("%s : points not in the same order, reordering ...\n", tmpob->name); reorder(tmpob, tmpob2, *textarray, *vertexarray); printf("%s : reordering ... done\n", tmpob->name); } break; } return; } ありがとうございます. 上記のコードをVisual Studio 2017 Communityにおいてビルドを行うと以下のエラーが発生します. 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態 エラー (アクティブ) E1696 ソース ファイルを開けません "strcmp.h" accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 29 エラー (アクティブ) E0020 識別子 "strcmp" が定義されていません accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 56 エラー (アクティブ) E0020 識別子 "printf" が定義されていません accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 86 エラー (アクティブ) E0020 識別子 "fabs" が定義されていません accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 79 エラー (アクティブ) E0020 識別子 "stricmp" が定義されていません accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 72
y_waiwai

2018/12/05 07:07

> #include <strcmp.h> strcmp.h というヘッダファイルはありません。(エラーメッセージそのままですね) 正しくは、string.h です
muton

2018/12/05 07:11

何度もすみません,ありがとうございます.#include <strcmp.h>を#include <string.h>に変更しました.以下の様なエラーが発生します. 重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態 エラー (アクティブ) E1696 ソース ファイルを開けません "string.h" accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 29 エラー (アクティブ) E0020 識別子 "strcmp" が定義されていません accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 56 エラー (アクティブ) E0020 識別子 "stricmp" が定義されていません accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 72 エラー (アクティブ) E0020 識別子 "fabs" が定義されていません accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 79 エラー (アクティブ) E0020 識別子 "printf" が定義されていません accc C:\Users\owner\Desktop\torcs-1.3.7\src\tools\accc\ac3dgroup.cpp 86
muton

2018/12/05 07:47

追記 C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt 内にあるstring.hファイルを対象のフォルダ内にコピーしたところ, ビルド前のエラーはなくなりました.ありがとうございました.
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問