2017-01-24 2 views
1

私は完全にC++を新しくしており、実行したいデータ解析プログラムを手渡しました。私は本質的に1つのエラーがあるだけです(何百というものを取り除いた後)が、これが意味するものを解読することはできません。このコードはMacでもうまく動作しますが、WindowsはWindowsです。私はVisual Studioも使用しています。'WORD': 'char [20]'は 'unsigned short'からの間接的なレベルが異なります

これはエラーが発生したスクリプトです。エラーが読み込みラインである:Windowsでは

typedef char WORD[NWORD]; 

/*********************************************** 

Header file with generally useful Macros 

Version for C++ 

As written here, can be included "indescriminantly" 
without danger of multiple definitions. Nothing will 
be inserted if content has already been included. 

Program must also include stdio.h and stdlib.h, but these 
are almost universal. 

*********************************************************/ 

#ifndef MCRO 

#define MCRO 

#define PI 3.14159265358979 

#define AND  && 
#define OR  || 
#define IS  == 

#include <cstring> 


#define STRCHK(x,y) if(strlen(x) >= (y)) {printf("String %s too long\n",x);exit(0);} 

// This is a macro for checking reads for overrunning memory allocation 
// It is a function void STRCHK(char* x, int y) that quits program if 
// string is filled beyond its capacity y. 
// NOTE: No ';' is needed to end line with this Macro. 


#define SKIPLINE(x) fscanf(x,"%*s%*[^\n\r][\n\r]") 
// This macro skips a line in reading the file (pointer) x 
// It works regardless of whether \n or\r is used for new lines 

#define NWORD 20 
#define NPHRASE 200 

typedef char WORD[NWORD];  // Utilities for construction of arrays of strings 
typedef char PHRASE[NPHRASE]; 

#endif 
+0

すべてのシズムには何がありますか?あなたがC++を書いているのなら、なぜC++を使わないのですか? – NathanOliver

+0

@ NathanOliver: "データ解析プログラムを手渡しました" –

+0

エラーが発生したときにこれが含まれていたファイルを表示できますか? –

答えて

2

を「WORD」が<はWindows.h >に埋もれの#defineで定義されたシンボル[悪い習慣が、歴史は右、前方互換性を必要とする]

独自の定義のために "WORD"以外のものを使用する必要があります。

このMicrosoft Pageには、他の危険な記号がいくつか表示されます。

関連する問題