Cannot run cspice with g++

I wanted to run cspice via g++ on windows. It gives undefined reference errors for the functions defined through cspice. It runs properly in Linux. Can anyone suggest a method to make it work.
I run:
g++ -LK:\Data\cspice\lib -IF:\CPP\Libraries\Boost\boost_1_68_0 -o foo foo.cpp -l:cspice.a -lm
The errors I get are:
undefined reference to 'furnsh_c'
and other functions I use from 'SpiceUsr.h'.
Am I not linking the file properly or what is the error.
> -l:cspice.a
Try it with just -lcspice
Gives error cannot find -lcspice
So what's the actual name of the library file(s) in K:\Data\cspice\lib

Did you just download them, or did you build them yourself using your current compiler?
I downloaded them from naif website. (https://naif.jpl.nasa.gov/naif/toolkit_C.html). I downloaded the version for PC Linux gCC 64 bit.
The name of the library is cspice.a
Last edited on
> I downloaded the version for PC Linux gCC 64 bit.
So what's with all the Windows paths on the command line?

Which version of g++ are you using? cygwin or mingw?
Mingw. I tried with MS Visual C 64 bit version but it did not work either

What version should I use.
Last edited on
Probably start by downloading the tar file for "PC, CYGWIN, gCC, 64bit"
But you'll need to hack about the build and install scripts to use your actual compiler of choice.

Thanks for the help.

As for the last point can you elaborate further.
Registered users can post here. Sign in or register to post.