9

Am Folowing dieses tutorial Qt 4.8 mit Visual Studio 2013 zu kompilieren, aber Nmake i nach dem Laufen bekommen:Qt 4.8, Visual Studio 2013 kompilieren Fehler

C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
JSCallbackConstructor.cpp 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
JSCallbackFunction.cpp 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
JSCallbackObject.cpp 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
JSClassRef.cpp 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
JSContextRef.cpp 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
JSObjectRef.cpp 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
JSStringRef.cpp 
JSValueRef.cpp 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
OpaqueJSString.cpp 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed 
C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084: function 'bool signbit(double)' already has a body 
     C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(324) : see previous definition of 'signbit' 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(615) : error C2264: 'signbit' : error in function definition or declaration; function not called 
c:\qt\4.8.5.src\src\3rdparty\javascriptcore\javascriptcore\runtime\JSValue.h(696) : error C2264: 'signbit' : error in function definition or declaration; function not called 
Generating Code... 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\cl.EXE"' : return code '0x2' 
Stop. 
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe"' : return code '0x2' 
Stop. 
NMAKE : fatal error U1077: 'cd' : return code '0x2' 

Vielen Dank für jede Hilfe

Antwort

17

Zur Fixierung 'rund' und 'roundf' Fehler ersetzen (Linien 103 und 110):

static double round(double num) 
static float roundf(float num) 

mit:

static inline double round(double num) 
static inline float roundf(float num) 

zu beheben 'Vorzeichenbit' Fehler sie umschließen mit Makro folgenden (Linie 128):

#if _MSC_VER < 1800 
inline bool signbit(double num) { return _copysign(1.0, num) < 0; } 
#endif 
+4

Noch besser wäre es, verwenden Sie die offizielle [Patch] (https://qt.gitorious.org/qt/qtscript/commit/24d678ce9c3996f46d1069c2b1193e7ec1083fc8). – JPaget

+0

Ich habe beide Patches von JPaget und Zdenik getestet und sie funktionieren nicht in Qt 4.8.6. Dies ist die einzige funktionierende Antwort. – Nil

+0

Basierend auf der erweiterten C99-Bibliothek in VS2013 - siehe Artikel [C99-Bibliotheksunterstützung in Visual Studio 2013] (https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-invisual -studio-2013 /) umschließen alte Implementierung mit Code: '#if _MSC_VER <1800 ... # endif' – N0dGrand87

2

Ihr Problem ist, dass Sie nicht Visual Studio 2012, aber 2013 VS 2012 verwenden Sie ist VS11 während VS 2013 VS12 und Ihrem Pfad "C: \ Program Files (x86) \ Microsoft Visual Studio 12.0" ist gehört zu VS 2013.

Das Kernproblem ist jedoch, dass VS 2013 ist C99-konform, die Probleme in der V8-Engine und Javascriptcore verursacht.

Momentan gibt es keine Lösung, sondern manuelles Patchen.

7

die offizielle patch für VS 2013-Kompatibilität verwenden.

+2

Der vollständige Patch ist [hier] (https://qt.gitorious.org/qt/qtdeclarative/commit/a3f01331263eddbc502fb88734568ac38df5e316) – Zdenik

2

Die beiden oben vorgeschlagenen Patches waren nicht genug. In meinem Fall, nachdem sie zu Qt 4.8.5 Anwendung habe ich einen anderen Fehler:

HashSet.h(180) : error C2664: 'std::pair<WTF::HashTableConstIteratorAdapter<WTF::HashTable<void *,void *,WTF::IdentityExtractor<void *>,WTF::PtrHash<JSC::EncodedJSValue>,WTF::HashTraits<JS 
C::EncodedJSValue>,WTF::HashTraits<JSC::EncodedJSValue>>,void *>,bool>::pair(const std::pair<WTF::HashTableConstIteratorAdapter<WTF::HashTable<void *,void *,WTF::IdentityExtractor<void *>,WTF::P 
trHash<JSC::EncodedJSValue>,WTF::HashTraits<JSC::EncodedJSValue>,WTF::HashTraits<JSC::EncodedJSValue>>,void *>,bool> &)' : cannot convert argument 1 from 'std::pair<WTF::HashTableIterator<Key,Va 
lue,Extractor,HashFunctions,Traits,KeyTraits>,bool>' to 'const std::pair<WTF::HashTableConstIteratorAdapter<WTF::HashTable<void *,void *,WTF::IdentityExtractor<void *>,WTF::PtrHash<JSC::EncodedJ 
SValue>,WTF::HashTraits<JSC::EncodedJSValue>,WTF::HashTraits<JSC::EncodedJSValue>>,void *>,bool> &'                        
     with                                              
     [                                               
      Key=void *                                            
,   Value=void *                                           
,   Extractor=WTF::IdentityExtractor<void *>                                    
,   HashFunctions=WTF::PtrHash<JSC::EncodedJSValue>                                  
,   Traits=WTF::HashTraits<JSC::EncodedJSValue>                                   
,   KeyTraits=WTF::HashTraits<JSC::EncodedJSValue>                                  
     ]                                               
     Reason: cannot convert from 'std::pair<WTF::HashTableIterator<Key,Value,Extractor,HashFunctions,Traits,KeyTraits>,bool>' to 'const std::pair<WTF::HashTableConstIteratorAdapter<WTF::HashT 
able<void *,void *,WTF::IdentityExtractor<void *>,WTF::PtrHash<JSC::EncodedJSValue>,WTF::HashTraits<JSC::EncodedJSValue>,WTF::HashTraits<JSC::EncodedJSValue>>,void *>,bool>'      
     with                                              
     [                                               
      Key=void *                                            
,   Value=void *                                           
,   Extractor=WTF::IdentityExtractor<void *>                                    
,   HashFunctions=WTF::PtrHash<JSC::EncodedJSValue>                                  
,   Traits=WTF::HashTraits<JSC::EncodedJSValue>                                   
,   KeyTraits=WTF::HashTraits<JSC::EncodedJSValue>                                  
     ]                                               
     No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called                   
     .\wtf/HashSet.h(179) : while compiling class template member function 'std::pair<WTF::HashTableConstIteratorAdapter<WTF::HashTable<void *,void *,WTF::IdentityExtractor<void *>,WTF::PtrHa 
sh<JSC::EncodedJSValue>,WTF::HashTraits<JSC::EncodedJSValue>,WTF::HashTraits<JSC::EncodedJSValue>>,void *>,bool> WTF::HashSet<void *,WTF::PtrHash<JSC::EncodedJSValue>,WTF::HashTraits<JSC::Encode 
dJSValue>>::add(void *const &)'                                         

Lösung war 3 Dateien von Git Qt4-Repository greifen:

/src/3rdparty/Webkit/Quelle/Javascript/wtf/HashSet.h https://qt.gitorious.org/qt/mi-clone/raw/b45cc6bba9f85497eedf10cb5969d24273cb11db:src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h

/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h https://qt.gitorious.org/qt/mi-clone/raw/b45cc6bba9f85497eedf10cb5969d24273cb11db:src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h

/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h https://qt.gitorious.org/qt/mi-clone/raw/b45cc6bba9f85497eedf10cb5969d24273cb11db:src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h

+0

Aus Gründen der Klarheit relink ich die vorgeschlagenen Patches in Frage Kommentare: https://qt.gitorious.org/qt/qtscript/commit/24d678ce9c3996f46d1069c2b1193e7ec1083fc8 und https://qt.gitorious.org/qt/qtdeclarative/commit/a3f01331263eddbc502fb88734568ac38df5e316 –

+0

Da die gitorious Site mit Patches seit Tagen offline ist (migrierende Sachen), kann mir bitte jemand die gepatchte Datei für /src/3rdparty/**webkit**/Source/JavaScriptCore/wtf/HashSet.h schicken, da dieser Fehler vorliegt immer noch ** nicht ** behoben 4.8.6 (allthough /src/3rdparty/**javascriptcore/JavaScriptCore/wtf/HashSet.h kompiliert). Danke, Hermann –

0

@ AppDealer's awnser funktioniert, wenn Sie es auf beide Instanzen der MathExtras.h Datei anwenden müssen. (Ein in JavaScriptCore und ein anderer in Webkit Nach , die Sie in einem HashSet Build Problem laufen.

No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called .\wtf/HashSet.h 

Beide Probleme werden Korrekturen mit dem patch, die auf this issue gefunden werden kann.