lagadic / vision_visp

ViSP stack for ROS
http://wiki.ros.org/vision_visp
GNU General Public License v2.0
182 stars 90 forks source link

undefined reference to `vpGaussRand::gaussianDraw()' #14

Closed ghost closed 10 years ago

ghost commented 10 years ago

I get the following error when I run rosmake:

vision_visp/visp/install/include/visp/vpNoise.h:163: undefined reference to `vpGaussRand::gaussianDraw()

fspindle commented 10 years ago

I'm not able to reproduce the error, but I see some possible hints in vpNoise.h Which is the ViSP version that you use ?

ghost commented 10 years ago

I cloned the most recent version from this github repository. To be clear, I can build ViSP, but when I link to it from my project and use rosmake I get the error above. I'm using many other visp components which all work without a problem.

fspindle commented 10 years ago

Can you try the following:

Update vpNoise.h by copy/past of a new version of the vpGaussRand class: cd vision_visp/visp/build/ViSP-2.8.0/src/math/misc modify vpNoise.h with the code below

Now you have to build ViSP: cd vision_visp/visp rm -rf install make

(here you should see [ 0%] Generating ../include/visp/vpNoise.h indicating that the new version of vpNoise.h is taken into account when libvisp is build)

Try to rebuild vision_visp

Since I'm not able to attach vpNoise.h file, below you will find the new version of the vpGaussRand class that you can copy/past:

class VISP_EXPORT vpGaussRand : public vpUniRand { private: double mean; double sigma; double gaussianDraw();

public:

// Initialization
vpGaussRand() {init();mean=0;sigma=0;x=739806647;}
vpGaussRand(const double sqrtvariance,
        const double _mean,
        const long seed = 0):mean(_mean), sigma(sqrtvariance)
{
    init() ;
    mean = 0 ;
    if (seed) x=seed; else x=739806647;
}
/*!
  Set the standard deviation and mean for gaussian noise

  \param _s new standard deviation
  \param _m new mean
 */
void setSigmaMean(const double _s, const double _m) {mean=_m;sigma=_s;}
/*!
    Set the seed of the noise

    \param seed new seed
 */
void seed(const long seed) {x=seed;}
double operator()() {return sigma*gaussianDraw()+mean;}

};

ghost commented 10 years ago

That seems to have fixed the issue! Thanks.