Cześć wszystkim szukałem kodu żeby zamieniał mi współrzędne z jednych na drugie ( odwzorowanie przy biegunach ) i znalazłem stronę przekopiowałem kody ze stony.http://earth-info.nga.mil/GandG/geotrans/geotrans3.7/docs/html/_u_p_s_8h_source.html
dodałem te pliki nagłówkowe .h do tego projektu nie wiem czy za wiele czy za mało już sam :)
Jak widać odpaliłem i pełno błędów i teraz nie wiem co jest nie tak jak to poprawić żeby u mnie także taki program działał
Brakuje klas..
miałem w życiu coś o programowaniu ale w tym nie siedzę czyli ?
W dużym skrócie: Budowanie projektu składa się z kompilacji i linkowania. Kompilacja z plików źródłowych tworzy coś, co potem linker w trakcie linkowania składa w całość.
Pliki źródłowe to takie z rozszerzeniem .cpp, w nich musi znajdować się definicja tego, co jedynie zadeklarowane jest w plikach nagłówkowych (ang header, czyli rozszerzenie .h).
Jeśli tych definicji brakuje, linker będzie krzyczał tak jak u Ciebie, że brakuje mu symboli.
edit: Kolega @au7h mówi Ci, że brakuje właśnie definicji klas (przypominam: definicja zawarta być powinna w plikach źródłowych .cpp), które zadeklarowane są w nagłówkach, które dodałeś do projektu.
hm może pozwolę wstawić ten kod czyli to jest mój plik żródłowy
#include "stdafx.h"
#include <math.h>
#include "UPS.h"
#include "PolarStereographic.h"
#include "PolarStereographicScaleFactorParameters.h"
#include "MapProjectionCoordinates.h"
#include "UPSCoordinates.h"
#include "GeodeticCoordinates.h"
#include "CoordinateConversionException.h"
#include "ErrorMessages.h"
using namespace MSP::CCS;
#define EPSILON 1.75e-7 /* approx 1.0e-5 degrees (~1 meter) in radians */
const double PI = 3.14159265358979323e0; /* PI */
const double PI_OVER = (PI / 2.0e0); /* PI over 2 */
const double MAX_LAT = 90.0 * (PI / 180.0); /* 90 degrees in radians */
const double MAX_ORIGIN_LAT = 81.114528 * (PI / 180.0);
const double MIN_NORTH_LAT = 83.5 * (PI / 180.0);
const double MAX_SOUTH_LAT = -79.5 * (PI / 180.0);
const double MIN_EAST_NORTH = 0.0;
const double MAX_EAST_NORTH = 4000000.0;
const double UPS_False_Easting = 2000000;
const double UPS_False_Northing = 2000000;
const double UPS_Origin_Longitude = 0.0;
UPS::UPS(double ellipsoidSemiMajorAxis, double ellipsoidFlattening) :
CoordinateSystem(),
UPS_Origin_Latitude(MAX_ORIGIN_LAT)
{
double inv_f = 1 / ellipsoidFlattening;
if (ellipsoidSemiMajorAxis <= 0.0)
{ /* Semi-major axis must be greater than zero */
throw CoordinateConversionException(ErrorMessages::semiMajorAxis);
}
if ((inv_f < 250) || (inv_f > 350))
{ /* Inverse flattening must be between 250 and 350 */
throw CoordinateConversionException(ErrorMessages::ellipsoidFlattening);
}
semiMajorAxis = ellipsoidSemiMajorAxis;
flattening = ellipsoidFlattening;
polarStereographicMap['N'] = new PolarStereographic(semiMajorAxis, flattening, UPS_Origin_Longitude, .994, 'N', UPS_False_Easting, UPS_False_Northing);
polarStereographicMap['S'] = new PolarStereographic(semiMajorAxis, flattening, UPS_Origin_Longitude, .994, 'S', UPS_False_Easting, UPS_False_Northing);
}
UPS::UPS(const UPS &u)
{
std::map< char, PolarStereographic* > tempPolarStereographicMap = u.polarStereographicMap;
polarStereographicMap['N'] = new PolarStereographic(*tempPolarStereographicMap['N']);
polarStereographicMap['S'] = new PolarStereographic(*tempPolarStereographicMap['S']);
semiMajorAxis = u.semiMajorAxis;
flattening = u.flattening;
UPS_Origin_Latitude = u.UPS_Origin_Latitude;
}
UPS::~UPS()
{
while (polarStereographicMap.begin() != polarStereographicMap.end())
{
delete ((*polarStereographicMap.begin()).second);
polarStereographicMap.erase(polarStereographicMap.begin());
}
}
UPS& UPS::operator=(const UPS &u)
{
if (this != &u)
{
std::map< char, PolarStereographic* > tempPolarStereographicMap = u.polarStereographicMap;
polarStereographicMap['N']->operator=(*tempPolarStereographicMap['N']);
polarStereographicMap['S']->operator=(*tempPolarStereographicMap['S']);
semiMajorAxis = u.semiMajorAxis;
flattening = u.flattening;
UPS_Origin_Latitude = u.UPS_Origin_Latitude;
}
return *this;
}
MSP::CCS::UPSCoordinates* UPS::convertFromGeodetic(MSP::CCS::GeodeticCoordinates* geodeticCoordinates)
{
char hemisphere;
double longitude = geodeticCoordinates->longitude();
double latitude = geodeticCoordinates->latitude();
if ((latitude < -MAX_LAT) || (latitude > MAX_LAT))
{ /* latitude out of range */
throw CoordinateConversionException(ErrorMessages::latitude);
}
else if ((latitude < 0) && (latitude >= (MAX_SOUTH_LAT + EPSILON)))
throw CoordinateConversionException(ErrorMessages::latitude);
else if ((latitude >= 0) && (latitude < (MIN_NORTH_LAT - EPSILON)))
throw CoordinateConversionException(ErrorMessages::latitude);
if ((longitude < -PI) || (longitude >(2 * PI)))
{ /* longitude out of range */
throw CoordinateConversionException(ErrorMessages::longitude);
}
if (latitude < 0)
{
UPS_Origin_Latitude = -MAX_ORIGIN_LAT;
hemisphere = 'S';
}
else
{
UPS_Origin_Latitude = MAX_ORIGIN_LAT;
hemisphere = 'N';
}
PolarStereographic polarStereographic = *polarStereographicMap[hemisphere];
MapProjectionCoordinates* polarStereographicCoordinates = polarStereographic.convertFromGeodetic(geodeticCoordinates);
double easting = polarStereographicCoordinates->easting();
double northing = polarStereographicCoordinates->northing();
delete polarStereographicCoordinates;
return new UPSCoordinates(CoordinateType::universalPolarStereographic, hemisphere, easting, northing);
}
MSP::CCS::GeodeticCoordinates* UPS::convertToGeodetic(MSP::CCS::UPSCoordinates* upsCoordinates)
{
char hemisphere = upsCoordinates->hemisphere();
double easting = upsCoordinates->easting();
double northing = upsCoordinates->northing();
if ((hemisphere != 'N') && (hemisphere != 'S'))
throw CoordinateConversionException(ErrorMessages::hemisphere);
if ((easting < MIN_EAST_NORTH) || (easting > MAX_EAST_NORTH))
throw CoordinateConversionException(ErrorMessages::easting);
if ((northing < MIN_EAST_NORTH) || (northing > MAX_EAST_NORTH))
throw CoordinateConversionException(ErrorMessages::northing);
if (hemisphere == 'N')
{
UPS_Origin_Latitude = MAX_ORIGIN_LAT;
}
else if (hemisphere == 'S')
{
UPS_Origin_Latitude = -MAX_ORIGIN_LAT;
}
MapProjectionCoordinates polarStereographicCoordinates(
CoordinateType::polarStereographicStandardParallel, easting, northing);
PolarStereographic polarStereographic = *polarStereographicMap[hemisphere];
GeodeticCoordinates* geodeticCoordinates =
polarStereographic.convertToGeodetic(&polarStereographicCoordinates);
double latitude = geodeticCoordinates->latitude();
if ((latitude < 0) && (latitude >= (MAX_SOUTH_LAT + EPSILON)))
{
delete geodeticCoordinates;
throw CoordinateConversionException(ErrorMessages::latitude);
}
if ((latitude >= 0) && (latitude < (MIN_NORTH_LAT - EPSILON)))
{
delete geodeticCoordinates;
throw CoordinateConversionException(ErrorMessages::latitude);
}
return geodeticCoordinates;
}
a tu np. z pliku nagłówkowego jednego kod ```
#ifndef UPSCoordinates_H
#define UPSCoordinates_H
#include "CoordinateTuple.h"
#include "DtccApi.h"
namespace MSP
{
namespace CCS
{
class MSP_DTCC_API UPSCoordinates : public CoordinateTuple
{
public:
UPSCoordinates();
UPSCoordinates( CoordinateType::Enum _coordinateType );
UPSCoordinates( CoordinateType::Enum _coordinateType, char __hemisphere, double __easting, double __northing );
UPSCoordinates( CoordinateType::Enum _coordinateType, const char* __warningMessage, char __hemisphere, double __easting, double __northing );
UPSCoordinates( const UPSCoordinates& c );
~UPSCoordinates();
UPSCoordinates& operator=( const UPSCoordinates &c );
void set( char __hemisphere, double __easting, double __northing );
char hemisphere() const;
double easting() const;
double northing() const;
private:
char _hemisphere;
double _easting;
double _northing;
};
}
}
#endif
Troszkę za dużo dla mnie tych linijek,"niby "rozumiem Bartosz co napisałeś ale i tak mam z tym problem...:(
A gdzie masz definicję UPSCoordinates::UPSCoordinates
? albo UPSCoordinates::hemisphere
?
Nie podałeś a to jest właśnie źródłem problemu.
W sensie, że linker nie może znaleźć definicji tych symboli (ma tylko ich deklarację).
ok coś zmieniłem już o wiele mniej błedów się pojawiło nie wiem co z tym stdfax. i te inne bledy ..
wyłącz precompilowane headery to zniknie ;p
eh po wyłączeniu znów powtórka :)