Error during compiling the example using g++

Feb 21, 2014 at 5:17 PM
Edited Feb 21, 2014 at 5:21 PM

I would like to try out the library, but had problems compiling the example code given in the documentation.

I am trying to compile using gcc (actually g++), with the -std=c++0x switch (or gnu pendant), but get a large number of errors and warnings. Below I have added the first error appearing.

I was originally thinking this is due to an old compiler, but I got the same error also with gcc 4.8.1 (which should have all new-spec features).

Is there any hint that I could follow up?


Compile cmd line: (KLXLL points to the library root) (compiled on win32)
gPLUSPLUS -c -std=gnuPLUSPLUS0x -I%KLXLL% xlTest1.cpp
and the content of xlTest1.cpp is

#include <cmath>
#include "xll/xll.h"
// Another error surrounding "Excel4" if I leave out the following line:
#include "xll/XLCALL.h"

using namespace xll;

static AddIn xai_exp(
    "?xll_exp", XLL_DOUBLE XLL_DOUBLE,
    "XLL.EXP", "Number"
double WINAPI xll_exp(double number)

    return exp(number);

Error output
..//xll20120116/trunk/xll/loper.h: In constructor 'LXOPER<X>::LXOPER()':
..//xll20120116/trunk/xll/loper.h:11:3: error: 'xltype' was not declared in this scope
   xltype = xltypeNil;
..//xll20120116/trunk/xll/loper.h: In member function 'LXOPER<X>::operator double() const':
..//xll20120116/trunk/xll/loper.h:49:10: error: 'to_number' was not declared in this scope
   return to_number<X>(*this);
..//xll20120116/trunk/xll/loper.h:49:21: error: expected primary-expression before '>' token
   return to_number<X>(*this);
..//xll20120116/trunk/xll/loper.h: In member function 'const X& LXOPER<X>::operator[](typename xll::traits<X>::xword) const':
..//xll20120116/trunk/xll/loper.h:53:10: error: 'index' is not a member of 'xll'
   return xll::index<X>(*this, i);

Feb 21, 2014 at 5:41 PM
Don't use gcc. Use Visual Studio. VS Express is free.
Feb 22, 2014 at 2:14 AM
Can you give a hint (or informed guess) what might be a problem with the compilation there? For example, any speciality concerning the definition of member "xltype", any language concepts etc?
Feb 22, 2014 at 1:56 PM
Yes, xll.h includes windows.h. Where is gcc is going to find that?