Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Proj4 version 4.8.0, after compiled by vc i had proj.dll and proj.lib But when i used proj.lib in my project vc++, i cannot compile that project. Here is my code :

#include <iostream>
#include "proj_api.h";
using namespace std;

int main()
    double x = 138494.92605;
    double y = 467792.640021;

    char *srid28992 = "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.04,49.91,465.84,-1.9848,1.7439,-9.0587,4.0772 +units=m +no_defs";
    char *srid4326 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";

    projPJ source = pj_init_plus(srid28992);
    projPJ target = pj_init_plus(srid4326);

    if(source==NULL || target==NULL)
        return false;

    //  x *= DEG_TO_RAD;
    //  y *= DEG_TO_RAD;

    int success = pj_transform(source, target, 1, 1, &x, &y, NULL );

    x *= RAD_TO_DEG;
    y *= RAD_TO_DEG;

    cout << success << endl << x << endl << y << endl;

Here is message of visual studio :

1>------ Build started: Project: Proj4ApiExam, Configuration: Debug Win32 ------ 1>Source.obj : error LNK2019: unresolved external symbol _pj_transform referenced in function _main 1>Source.obj : error LNK2019: unresolved external symbol _pj_init_plus referenced in function _main

share|improve this question
up vote 1 down vote accepted

Modify Project > Properties > Linker > Input > Additional Dependencies adding proj.lib and modify Project > Properties > Linker > General > Additional Library Directories with the path to proj.lib

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.