2012-02-15 4 views
3

私のC++プログラムをコンパイルすることができません。ご覧のとおり、Node.jsアドオンを作成しています。ここでは、コード(Eamorr_addon.cpp)は次のとおりです。私はライン#include "tbb/concurrent_hash_map.h"を削除するとC++:スレッドビルディングブロック - インクルード

#include <iostream> 
#include <v8.h> 
#include <node.h> 
#include <gmp.h> 

#include "Definitions.h" 
#include "Rk.h" 

#include "tbb/concurrent_hash_map.h" 
//#include <tbb/concurrent_vector.h> 

using namespace std; 
using namespace v8; 



static Handle<Value> Echo(const Arguments& args) { 
    HandleScope scope; 

    if (args.Length() < 1) { 
     return ThrowException(Exception::TypeError(String::New("Bad argument"))); 
    } 

    return scope.Close(args[0]); 
} 

extern "C" void init (Handle<Object> target) 
{ 
    HandleScope scope; 
    target->Set(String::New("hello"), String::New("world")); 

    NODE_SET_METHOD(target, "echo", Echo); 
} 

すべてがうまく動作します。

{ 
    'targets': [ 
    { 
     'target_name':'Eamorr_addon', 
     'sources':['src/Eamorr_addon.cpp'], 
     'include_dirs': ['/usr/include','/usr/local/include/'], 
     'cflags': ['-Wall','-fopenmp'], 
     'ldflags': ['-ltbb','-lgmp'] 
    } 
    ] 
} 

私はnode-gyp buildを行うと、私はの底に得ることができないエラーの次ストリームを取得:

node-gyp build 
info it worked if it ends with ok 
spawn make [ 'BUILDTYPE=Release', '-f', 'Makefile.gyp' ] 
    CXX(target) out/Release/obj.target/DeDuplicator_addon/src/DeDuplicator_addon.o 
In file included from /usr/include/tbb/concurrent_hash_map.h:51:0, 
       from src/DeDuplicator_addon.cpp:17: 
/usr/include/tbb/atomic.h:218:31: error: expected nested-name-specifier before numeric constant 
/usr/include/tbb/atomic.h:218:31: error: expected ‘>’ before numeric constant 
/usr/include/tbb/atomic.h:224:33: error: expected ‘)’ before ‘addend’ 
/usr/include/tbb/atomic.h:224:40: error: ISO C++ forbids initialization of member ‘fetch_and_add’ 
/usr/include/tbb/atomic.h:224:40: error: making ‘fetch_and_add’ static 
/usr/include/tbb/atomic.h:224:40: error: template declaration of ‘value_type tbb::internal::fetch_and_add’ 
In file included from /usr/include/tbb/concurrent_hash_map.h:51:0, 
       from src/DeDuplicator_addon.cpp:17: 
/usr/include/tbb/atomic.h:228:31: error: expected identifier before numeric constant 
/usr/include/tbb/atomic.h:228:31: error: expected ‘,’ or ‘...’ before numeric constant 
/usr/include/tbb/atomic.h:251:28: error: expected identifier before numeric constant 
/usr/include/tbb/atomic.h:251:28: error: expected ‘,’ or ‘...’ before numeric constant 
/usr/include/tbb/atomic.h:255:28: error: expected identifier before numeric constant 
/usr/include/tbb/atomic.h:255:28: error: expected ‘,’ or ‘...’ before numeric constant 
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::fetch_and_add(int)’: 
/usr/include/tbb/atomic.h:229:48: error: ‘addend’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::fetch_and_decrement()’: 
/usr/include/tbb/atomic.h:243:33: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:243:33: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:243:33: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::fetch_and_decrement()’: 
/usr/include/tbb/atomic.h:247:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:247:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:247:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::operator+=(int)’: 
/usr/include/tbb/atomic.h:252:30: error: ‘addend’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::operator-=(int)’: 
/usr/include/tbb/atomic.h:258:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:258:32: error: ‘addend’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::operator--()’: 
/usr/include/tbb/atomic.h:266:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:266:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:266:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h: In member function ‘value_type tbb::internal::atomic_impl_with_arithmetic<I, <anonymous> >::operator--(int)’: 
/usr/include/tbb/atomic.h:274:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:274:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h:274:30: error: ‘2’ cannot be used as a function 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:329:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘long long int tbb::atomic<long long int>::operator=(long long int)’: 
/usr/include/tbb/atomic.h:329:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<long long int>& tbb::atomic<long long int>::operator=(const tbb::atomic<long long int>&)’: 
/usr/include/tbb/atomic.h:329:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:330:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘long long unsigned int tbb::atomic<long long unsigned int>::operator=(long long unsigned int)’: 
/usr/include/tbb/atomic.h:330:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<long long unsigned int>& tbb::atomic<long long unsigned int>::operator=(const tbb::atomic<long long unsigned int>&)’: 
/usr/include/tbb/atomic.h:330:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:335:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘long int tbb::atomic<long int>::operator=(long int)’: 
/usr/include/tbb/atomic.h:335:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<long int>& tbb::atomic<long int>::operator=(const tbb::atomic<long int>&)’: 
/usr/include/tbb/atomic.h:335:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:336:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘long unsigned int tbb::atomic<long unsigned int>::operator=(long unsigned int)’: 
/usr/include/tbb/atomic.h:336:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<long unsigned int>& tbb::atomic<long unsigned int>::operator=(const tbb::atomic<long unsigned int>&)’: 
/usr/include/tbb/atomic.h:336:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:352:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘unsigned int tbb::atomic<unsigned int>::operator=(unsigned int)’: 
/usr/include/tbb/atomic.h:352:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<unsigned int>& tbb::atomic<unsigned int>::operator=(const tbb::atomic<unsigned int>&)’: 
/usr/include/tbb/atomic.h:352:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:353:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘int tbb::atomic<int>::operator=(int)’: 
/usr/include/tbb/atomic.h:353:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<int>& tbb::atomic<int>::operator=(const tbb::atomic<int>&)’: 
/usr/include/tbb/atomic.h:353:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:356:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘short unsigned int tbb::atomic<short unsigned int>::operator=(short unsigned int)’: 
/usr/include/tbb/atomic.h:356:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<short unsigned int>& tbb::atomic<short unsigned int>::operator=(const tbb::atomic<short unsigned int>&)’: 
/usr/include/tbb/atomic.h:356:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:357:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘short int tbb::atomic<short int>::operator=(short int)’: 
/usr/include/tbb/atomic.h:357:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<short int>& tbb::atomic<short int>::operator=(const tbb::atomic<short int>&)’: 
/usr/include/tbb/atomic.h:357:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:358:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘char tbb::atomic<char>::operator=(char)’: 
/usr/include/tbb/atomic.h:358:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<char>& tbb::atomic<char>::operator=(const tbb::atomic<char>&)’: 
/usr/include/tbb/atomic.h:358:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:359:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘signed char tbb::atomic<signed char>::operator=(signed char)’: 
/usr/include/tbb/atomic.h:359:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<signed char>& tbb::atomic<signed char>::operator=(const tbb::atomic<signed char>&)’: 
/usr/include/tbb/atomic.h:359:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:360:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘unsigned char tbb::atomic<unsigned char>::operator=(unsigned char)’: 
/usr/include/tbb/atomic.h:360:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<unsigned char>& tbb::atomic<unsigned char>::operator=(const tbb::atomic<unsigned char>&)’: 
/usr/include/tbb/atomic.h:360:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:363:1: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
/usr/include/tbb/atomic.h: In member function ‘wchar_t tbb::atomic<wchar_t>::operator=(wchar_t)’: 
/usr/include/tbb/atomic.h:363:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: In member function ‘tbb::atomic<wchar_t>& tbb::atomic<wchar_t>::operator=(const tbb::atomic<wchar_t>&)’: 
/usr/include/tbb/atomic.h:363:1: error: ‘store_with_release’ was not declared in this scope 
/usr/include/tbb/atomic.h: At global scope: 
/usr/include/tbb/atomic.h:367:93: error: wrong number of template arguments (3, should be 2) 
/usr/include/tbb/atomic.h:219:8: error: provided for ‘template<class I, int <anonymous> > struct tbb::internal::atomic_impl_with_arithmetic’ 
In file included from src/DeDuplicator_addon.cpp:17:0: 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘bool tbb::interface4::internal::hash_map_base::check_mask_race(tbb::interface4::internal::hash_map_base::hashcode_t, tbb::interface4::internal::hash_map_base::hashcode_t&) const’: 
/usr/include/tbb/concurrent_hash_map.h:266:21: error: cannot convert ‘const tbb::atomic<long unsigned int>’ to ‘tbb::interface4::internal::hash_map_base::hashcode_t’ in assignment 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘tbb::interface4::internal::hash_map_base::segment_index_t tbb::interface4::internal::hash_map_base::insert_new_node(tbb::interface4::internal::hash_map_base::bucket*, tbb::interface4::internal::hash_map_base::node_base*, tbb::interface4::internal::hash_map_base::hashcode_t)’: 
/usr/include/tbb/concurrent_hash_map.h:296:30: error: no match for ‘operator++’ in ‘++((tbb::interface4::internal::hash_map_base*)this)->tbb::interface4::internal::hash_map_base::my_size’ 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘void tbb::interface4::internal::hash_map_base::reserve(tbb::interface4::internal::hash_map_base::size_type)’: 
/usr/include/tbb/concurrent_hash_map.h:316:32: error: no match for ‘operator!’ in ‘!((tbb::interface4::internal::hash_map_base*)this)->tbb::interface4::internal::hash_map_base::my_size’ 
/usr/include/tbb/concurrent_hash_map.h:316:32: note: candidate is: operator!(bool) <built-in> 
/usr/include/tbb/concurrent_hash_map.h:317:32: error: cannot convert ‘tbb::atomic<long unsigned int>’ to ‘tbb::interface4::internal::hash_map_base::size_type’ in initialization 
/usr/include/tbb/concurrent_hash_map.h:317:58: error: cannot convert ‘tbb::atomic<long unsigned int>’ to ‘tbb::interface4::internal::hash_map_base::size_type’ in assignment 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘bool tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::empty() const’: 
/usr/include/tbb/concurrent_hash_map.h:833:44: error: no match for ‘operator==’ in ‘((const tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_size == 0’ 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘tbb::interface4::concurrent_hash_map::size_type tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::bucket_count() const’: 
/usr/include/tbb/concurrent_hash_map.h:839:53: error: no match for ‘operator+’ in ‘((const tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_mask + 1’ 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘bool tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::exclude(tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::const_accessor&, bool)’: 
/usr/include/tbb/concurrent_hash_map.h:1119:16: error: no ‘operator--(int)’ declared for postfix ‘--’ 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘bool tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::erase(const Key&)’: 
/usr/include/tbb/concurrent_hash_map.h:1160:16: error: no ‘operator--(int)’ declared for postfix ‘--’ 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘void tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::internal_copy(const tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>&)’: 
/usr/include/tbb/concurrent_hash_map.h:1310:20: error: no match for ‘operator==’ in ‘((tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_mask == mask’ 
/usr/include/tbb/concurrent_hash_map.h:1323:19: error: no match for ‘operator++’ in ‘++((tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_size’ 
/usr/include/tbb/concurrent_hash_map.h: In member function ‘void tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>::internal_copy(I, I)’: 
/usr/include/tbb/concurrent_hash_map.h:1340:11: error: no match for ‘operator++’ in ‘++((tbb::interface4::concurrent_hash_map<Key, T, HashCompare, A>*)this)->tbb::interface4::internal::hash_map_base::my_size’ 
make: *** [out/Release/obj.target/DeDuplicator_addon/src/DeDuplicator_addon.o] Error 1 
ERR! Error: `make` failed with exit code: 2 
    at Array.0 (/usr/local/lib/node_modules/node-gyp/lib/build.js:118:25) 
    at EventEmitter._tickCallback (node.js:192:40) 
ERR! not ok 

缶だれでもここ

は私GYPがファイルを作るです何か示唆している?


編集:

ここ

ある "Rk.h":

#ifndef RK_H_ 
#define RK_H_ 

#include <gmp.h> 
#include "Definitions.h" 

unsigned long int init_rkHash(char* str); 
unsigned long int get_rkHash(unsigned long int prevHash,int prevAscii,int topAscii); 
/*unsigned long int getFirstPrevHash(char* &buffer);*/ 

#endif /* RK_H_ */ 

、ここでは "Definitions.h" です:

#ifndef DEFINITIONS_H_ 
#define DEFINITIONS_H_ 

#define PORT 10002 
#define CHUNKSIZE 512 
#define PRIME 9223372036854775783 
#define D 2 


#endif /* DEFINITIONS_H_ */ 
マクロは使いやすいです
+1

ファイルの最後の宣言「Rk.hは」適切に終了する(すなわち:あなたはTBBヘッダを含むbeforそれを未定義にして問題を修正することができますD、このような何かが依存あまりにも多くのコードを持っていればセミコロンを紛失していないこと)? –

+0

あなたは確かにそこに何かをしています。私がRk.hとDefinitions.hをコメントアウトすると、コンパイルはちょうど良いようです!今すぐ調査する。 – Eamorr

+0

@JoachimPileborgちょっとヨアヒム - 私の編集を見てもらえますか?私は2つのインクルードファイルを掲示しました。私はまだ問題を見つけません。多くのありがとう、 – Eamorr

答えて

9

#define違う。 Dのような名前を付けると問題が発生します。

あなたは私たちがatomic.hを見れば今、私たちは例えば見つける

#define D 2 

としてDを定義し

... 
template<typename I, typename D, typename StepType> 
struct atomic_impl_with_arithmetic: atomic_impl<I> { 
... 
    value_type fetch_and_add(D addend) { 
... 
    template<memory_semantics M> 
    value_type fetch_and_decrement() { 
     return fetch_and_add<M>(__TBB_MINUS_ONE(D)); 
    } 
... 

相関関係を参照してください。

何が得ることである:

... 
template<typename I, typename 2, typename StepType> 
struct atomic_impl_with_arithmetic: atomic_impl<I> { 
... 
    value_type fetch_and_add(2 addend) { 
... 
    template<memory_semantics M> 
    value_type fetch_and_decrement() { 
     return fetch_and_add<M>(__TBB_MINUS_ONE(2)); 
    } 
... 

これは有効なC++ではありません。

解決方法:マクロにはおそらく衝突する名前を付けないでください。経験の浅い悪魔のビジョンを持つ夜間の夢を保守者(あなた?)に感染させる可能性のある、微妙で非現実的なエラーメッセージを生み出します。したがって、絶対に必要な場合にのみマクロを使用してください。

Dが(誰が、あなたを除いて、その名前を知っている?)の整数であると考えられる場合は、次のいずれかを行うことができます

enum { D = 2 }; 

または

extern const int D; // in a header 
const int D = 2; // in exactly one source file 

かDが常に一定である必要があるかどうかを判断し、関数とクラスのパラメータとしてDを渡すかどうかを考え直すことができます。

1

tbb/atomicの抜粋です。時間今

 

template<typename I, typename D, typename StepType> 
struct atomic_impl_with_arithmetic: atomic_impl<I> { 
public: 
    typedef I value_type; 

    template<memory_semantics M> 
    value_type fetch_and_add(D addend) { 
     return value_type(internal::atomic_traits<sizeof(value_type),M>::fetch_and_add(&this->rep.value, addend*sizeof(StepType))); 
    } 
... 
 

は、あなたがDefinitions.hからDの定義を置き換える場合は、問題が何であるかがわかります。一般に、そのような名前のマ​​クロ定義を作成することは悪い考えです。

 

#include "Definitions.h" 
#include "Rk.h" 

#pragma push_macro("D") 
#undef D 

#include "tbb/concurrent_hash_map.h" 
#include <tbb/concurrent_vector.h> 

#pragma pop_macro("D") 
 
+0

この場合、彼は多くのコードを持っていません。コンパイラ特有の拡張性とスケーラビリティを持たない拡張性をC++に提案する - 新参者は正しいことではありません。 –

+0

@phresnel:彼が持っているマクロである 'D 'に応じて、どのくらいのコードを知っていますか?そして、彼が新人かどうかはわかりませんが、デフォルトでは彼はそうではないと思います。また、実際にコンパイラに特化したものではありません。このプラグマは、少なくともGCC、MSVC、ICCでサポートされています。とにかく、解決策は1つの特定のケース(変更されるこのマクロに応じてコードが多すぎます)に対してのみ提案されました。 –

+0

あなたは正しいです、私は間違いなく、示されたコードが彼のほとんどすべてであると仮定しました。しかし、ソフトウェアをリエンジニアリングするとき、私はあなたがそのような拡張子を使うべきではないと思います(コードウォリアー、clang ++、openwatcom、...)すべて)。あなたのプロポーザルは縮尺されていません(Dを含むファイルを含むすべてのファイルにプッシュ/ポップを入れなければなりません。その名前が_now_と衝突するマクロごとにそのプロセスを繰り返す必要があります。各インクルードファイルの新しいバージョン用)。 ... –

関連する問題