
Errores portando aplicaciones C++ Windows a Solaris (IV)
29/12/2012Al portar una aplicación C++ para Windows desarrollada en Visual Studio hacia Solaris o entornos Unix, se recomienda utilizar las siguientes conversiones y consejos.
INCLUDES
src/Utils/sEcoCellRange.cpp", line 72: Error: The function "strdup" must have a prototype.
#include <cstring>
Map is not a member of std
#include <map>
size_t len = ::wcslen(wstr); : Error: wcslen is not a member of std.
#include <cwchar>
using std::wcslen;
"../../arguments/arguments.cpp", line 90: Error: The function "find" must have a prototype.
Añadir “using namespace std;”
String is not defined
añadir “using namespace std;”
"src/Utils/strings/StringUtils.cpp", line 20: Error: iswlower is not a member of std.
#include <wctype.h>
Error: size_t is not defined.
#include <stddef.h>
"headers/Utils/Strings/cAnsiString.h", line 187: Error: runtime_error is not a member of std.
#include <stdexcept>
"src/utils/strings/StringUtils.cpp", line 45: Error: The function "iswspace" must have a prototype.
#include <wctype.h>
"headers/Utils/Math/cholesky.h", line 18: Error: Utils::Math::Cholesky(Utils::DataContainers::cMatrix&, Utils::DataContainers::cVector&) already had a body defined.
comprobar que estén los ifndef´s:
#ifndef __CHOLESKY_H__
#define __CHOLESKY_H__
#enfif
"headers/NormDistr2.h", line 21: Error: Multiple declaration for cRandomNumberGenerator.
incluir en el header los ifndef:
#ifndef __NORMDISTR2__
#define __NORMDISTR2__
(…)
#endif
Namespaces cannot be declared in a class scope
comprobar cabecera.
"storage class extern not allowed for a member"
comprobar cabecera.
"../../EcoLibrary3b/src/cXLGreeks.cpp", line 41: Error: ")" expected instead of "&".
ver que esté declarado igual el método tanto en la cabecera como en el src y que los tipos de los parámetros se resuelven.
#ifdef _WIN32
(… código)
#endif
Muchos constructores no se reconocne en el código pese a que vienen en el .h correspondiente. Suele ocurrir que vienen precedidos en el .h de condicionar de que la plataforma sea WIN32. Al portarlo a Solaris u otra plataforma, hay que eliminar esa condición.
Deja una respuesta