Qt 4.8, error de compilación de Visual Studio 2013
visual-studio-2012 compiler-construction (6)
Siguiendo este tutorial para compilar Qt 4.8 con Visual Studio 2013, pero después de ejecutar nmake obtengo:
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''
Gracias por cualquier ayuda
¿Has ejecutado "vcvars32.bat" antes de compilar? Parece que las variables de entorno de VC ++ no están configuradas adecuadamente.
Consulte http://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx para obtener información sobre el entorno de VC ++.
adiós
El trabajo de Awnser de @ AppDealer, si tiene que aplicarlo a ambas instancias del archivo MathExtras.h
. (uno en JavaScriptCore
y otro en Webkit
Después de eso, se encontrará con un problema de compilación HashSet
.
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called ./wtf/HashSet.h
Ambos problemas son soluciones con el parche que se puede encontrar en este tema .
Los dos parches propuestos anteriormente no fueron suficientes. En mi caso, después de aplicarlos a Qt 4.8.5, recibí otro error:
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 &)''
La solución fue tomar 3 archivos del repositorio de Git Qt4:
/src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h https://qt.gitorious.org/qt/mi-clone/raw/b45cc6bba9f85497eedf10cb5969d24273cb11db:src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet. marido
/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h https://qt.gitorious.org/qt/mi-clone/raw/b45cc6bba9f85497eedf10cb5969d24273cb11db:src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras. marido
/src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h https://qt.gitorious.org/qt/mi-clone/raw/b45cc6bba9f85497eedf10cb5969d24273cb11db:src/3rdparty/javascriptcore/JavaScriptCore/wtf/MathExtras.h
Para corregir los errores ''round'' y ''roundf'', reemplace (líneas 103 y 110):
static double round(double num)
static float roundf(float num)
con:
static inline double round(double num)
static inline float roundf(float num)
Para corregir el error ''signbit'' enciérrelo con la siguiente macro (línea 128):
#if _MSC_VER < 1800
inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
#endif
Su problema es que no utiliza Visual Studio 2012 sino 2013. VS 2012 es VS11 mientras que VS 2013 es VS12 y su ruta "C: / Archivos de programa (x86) / Microsoft Visual Studio 12.0" pertenece a VS 2013.
Sin embargo, el problema principal es que VS 2013 es compatible con C99, lo que causa problemas en el motor V8 y javascriptcore.
Actualmente no hay solución, pero el parche manual.
Use el parche oficial para compatibilidad con VS 2013.