2016-07-18 6 views
16

मुझे उम्मीद है कि आप मेरी मदद कर सकते हैं। मैंने अपनी मुख्य देव मशीन पर CxxTest का उपयोग करके एक छोटी परियोजना लिखी है। इस मशीन पर सबकुछ बढ़िया काम करता है, कोई समस्या नहीं। हालांकि, मैंने इस प्रोजेक्ट को अपने ब्रांड के नए लैपटॉप पर स्थापित करने की कोशिश की और इसे काम पर नहीं लाया! मुझे संदेह है कि CxxTest की बजाय मेरी MinGW स्थापना के साथ कुछ गड़बड़ हो गया है, लेकिन यह जानना वाकई मुश्किल है - और त्रुटियां CxxTest फ़ाइलों से उत्पन्न होती हैं।मिनजीडब्ल्यू/सीओक्सटेस्ट विचित्र त्रुटियां

lib/ 
    cxxtest-4.3/ 
src/ 
    TestUtils.h 
    test.cpp 
test/ 
    MyTestSuite.h 
    libstdc++-6.dll 

कमांड लाइन मैं चलाने पर::

cd test 
..\lib\cxxtest-4.3\bin\cxxtestgen --error-printer -o runner.cpp MyTestSuite.h 

यह runner.cpp उत्पन्न करता है इस परियोजना के फ़ोल्डर संरचना है। अब मैं चलाता हूं:

g++ -o runner.exe runner.cpp -I "../lib/cxxtest-4.3" -std=c++11 

यह आमतौर पर रनर.एक्सई आउटपुट और मेरे यूनिट परीक्षण चलाने के लिए ठीक काम करता है। मेरे लैपटॉप पर मुझे हजारों त्रुटियां मिलती हैं। यहां केवल कुछ ही देखें:

In file included from c:\mingw\include\wchar.h:208:0, 
       from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\cwchar:44, 
       from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\bits\postypes.h:40, 
       from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\iosfwd:40, 
       from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\ios:38, 
       from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\istream:38, 
       from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\sstream:38, 
       from c:\mingw\lib\gcc\mingw32\4.9.3\include\c++\complex:45, 
       from ../lib/cxxtest-4.3/cxxtest/StdHeaders.h:24, 
       from ../lib/cxxtest-4.3/cxxtest/StdValueTraits.h:22, 
       from ../lib/cxxtest-4.3/cxxtest/ValueTraits.h:400, 
       from ../lib/cxxtest-4.3/cxxtest/TestSuite.h:24, 
       from ../lib/cxxtest-4.3/cxxtest/RealDescriptions.h:20, 
       from ../lib/cxxtest-4.3/cxxtest/TestRunner.h:22, 
       from runner.cpp:11: 
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type 
struct _stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:173:14: error: '_ino_t' does not name a type 
struct _stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:173:14: error: '_mode_t' does not name a type 
struct _stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:173:14: error: '_dev_t' does not name a type 
struct _stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:173:14: error: '_off_t' does not name a type 
struct _stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type 
struct _stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type 
struct _stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:173:14: error: 'time_t' does not name a type 
struct _stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:180:13: error: '_dev_t' does not name a type 
struct stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:180:13: error: '_ino_t' does not name a type 
struct stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:180:13: error: '_mode_t' does not name a type 
struct stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:180:13: error: '_dev_t' does not name a type 
struct stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:180:13: error: '_off_t' does not name a type 
struct stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type 
struct stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type 
struct stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:180:13: error: 'time_t' does not name a type 
struct stat __struct_stat_defined(_off_t, time_t); 
      ^
c:\mingw\include\sys/stat.h:188:17: error: '_dev_t' does not name a type 
struct _stati64 __struct_stat_defined(__off64_t, time_t); 
       ^
c:\mingw\include\sys/stat.h:188:17: error: '_ino_t' does not name a type 
struct _stati64 __struct_stat_defined(__off64_t, time_t); 
       ^
c:\mingw\include\sys/stat.h:188:17: error: '_mode_t' does not name a type 
struct _stati64 __struct_stat_defined(__off64_t, time_t); 
       ^
c:\mingw\include\sys/stat.h:188:17: error: '_dev_t' does not name a type 
struct _stati64 __struct_stat_defined(__off64_t, time_t); 
       ^
c:\mingw\include\sys/stat.h:188:17: error: '__off64_t' does not name a type 
struct _stati64 __struct_stat_defined(__off64_t, time_t); 
       ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type 
struct _stati64 __struct_stat_defined(__off64_t, time_t); 
       ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type 
struct _stati64 __struct_stat_defined(__off64_t, time_t); 
       ^
c:\mingw\include\sys/stat.h:188:17: error: 'time_t' does not name a type 
struct _stati64 __struct_stat_defined(__off64_t, time_t); 
       ^
c:\mingw\include\sys/stat.h:195:17: error: '_dev_t' does not name a type 
struct __stat64 __struct_stat_defined(__off64_t, __time64_t); 
       ^
c:\mingw\include\sys/stat.h:195:17: error: '_ino_t' does not name a type 
struct __stat64 __struct_stat_defined(__off64_t, __time64_t); 
       ^
c:\mingw\include\sys/stat.h:195:17: error: '_mode_t' does not name a type 
struct __stat64 __struct_stat_defined(__off64_t, __time64_t); 
       ^
c:\mingw\include\sys/stat.h:195:17: error: '_dev_t' does not name a type 
struct __stat64 __struct_stat_defined(__off64_t, __time64_t); 
       ^
c:\mingw\include\sys/stat.h:195:17: error: '__off64_t' does not name a type 
struct __stat64 __struct_stat_defined(__off64_t, __time64_t); 
       ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type 
struct __stat64 __struct_stat_defined(__off64_t, __time64_t); 
       ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type 
struct __stat64 __struct_stat_defined(__off64_t, __time64_t); 
       ^
c:\mingw\include\sys/stat.h:195:17: error: '__time64_t' does not name a type 
struct __stat64 __struct_stat_defined(__off64_t, __time64_t); 

जब मैं एक साधारण हैलो वर्ल्ड फ़ाइल पर g ++ चलाता हूं, तो यह ठीक काम करता है। क्या किसी को पता है कि क्या हो रहा है?

उत्तर

38

मैंने हाल ही में मिनजीडब्ल्यू को अपडेट किया और बहुत ही समान समस्याओं में भाग गया। कुछ शोध के बाद मुझे this question on SO मिला और -std=gnu++11 के साथ -std=c++11 को बदलने का प्रयास किया। इसने मेरे लिए इस मुद्दे को हल किया। उम्मीद है की वो मदद करदे!

+2

लुकास - धन्यवाद! यह वास्तव में मुद्दा था। अब मैं देखता हूं कि मेरे पास प्रत्येक मशीन पर मिनीजीडब्ल्यू के विभिन्न संस्करण हैं, जो कुछ मुझे उठाया जाना चाहिए था। – Draknir

+5

मुझे CLION के साथ यह समस्या थी। जैसा कि आपने लुकास का उल्लेख किया था, मुझे CMakeLists.txt और change -std = C++ 11 to -std = gnu ++ 11 संपादित करना था। धन्यवाद! – JDPeckham

संबंधित मुद्दे