Lars Gullik Bjønnes wrote:
> | cxx: Error: formulabase.C, line 367: identifier "abs" is undefined
> |          if (abs(x - first_x) < 2 && abs(y - first_y) < 2) {
> | ------------^
> 
> I belive that abs as a macro is not allowed in C++.
> Also it might be that you compiler (correctly) puts abs in namespace
> std. Try changing the abs(...) to std::abs(...)

Changing to std::abs works fine. I had to do the same in
src/mathed/math_xdata.C:214 (std::abs), src/mathed/math_charinset.C:52
(std::isalpha), src/mathed/math_cursor.C:1465,1549,1554 (std::isalpha),
src/mathed/math_mathmlstream.C:233 (std::strlen),
src/mathed/math_parser.C:781,897,903,909 (std::atoi).

Andre's suggestion ("using std::abs") works fine with cxx, too.

Going further:

- --- snip ---
/usr/bin/cxx -std strict_ansi -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ 
-I../.. -I../../boost -I/net/usr/include -ptr /tmp/lyx_cxx_repository 
-I/net/usr/include -c -MD insetbib.C
cxx: Error: ../../src/paragraph.h, line 366: type "Paragraph::InsetList" is
           inaccessible
                 inset_iterator(InsetList::iterator const & iter);
-------------------------------^
cxx: Error: ../../src/paragraph.h, line 389: type "Paragraph::InsetList" is
           inaccessible
                 InsetList::iterator it;
----------------^
cxx: Info: 2 errors detected in the compilation of "insetbib.C".
gmake[3]: *** [insetbib.lo] Error 1
gmake[3]: Leaving directory `/path/to/lyx-1.2.0/src/insets'
- --- snap ---

IIRC Angus' suggestion was to move "typedef std::vector<InsetTable> InsetList;"
and "InsetList insetlist;" from private to public in src/paragraph.h.

If I do this, it compiles until:

- --- snip ---
/usr/bin/cxx -std strict_ansi -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ 
-I../.. -I../../boost -I/net/usr/include -ptr /tmp/lyx_cxx_repository 
-I/net/usr/include -c -MD insetexternal.C
cxx: Error: insetexternal.C, line 295: the global scope has no "difftime"
                     ::difftime(fi2.getModificationTime(),
----------------------^
cxx: Info: 1 error detected in the compilation of "insetexternal.C".
gmake[3]: *** [insetexternal.lo] Error 1
gmake[3]: Leaving directory `/path/to/lyx-1.2.0/src/insets'
- --- snap ---

IIRC Angus suggested "#include <ctime>" in src/insets/insetexternal.C
which unfortunately doesn't fix it. When I manually add
"-I$(top_srcdir)/src/cheaders" to CPPFLAGS in src/insets/Makefile
(configure decided to put "lyx_cv_cxx_cheaders=yes" in config.cache),
I get conflicts:

- --- snip ---
/usr/bin/cxx -std strict_ansi -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ 
-I../.. -I../../boost -I../../src/cheaders -I/net/usr/include -ptr 
/tmp/lyx_cxx_repository -I/net/usr/include -c -MD insetexternal.C
cxx: Error: ../../src/cheaders/cstdlib, line 17: function "abs(long)"
           conflicts with using-declaration of function "std::abs(long)"
inline long   abs(long x)               { return x >= 0 ? x : -x; }
--------------^
cxx: Info: 1 error detected in the compilation of "insetexternal.C".
gmake[3]: *** [insetexternal.lo] Error 1
gmake[3]: Leaving directory `/path/to/lyx-1.2.0/src/insets'
- --- snap ---

Well, with an ugly "#include <time.h>" it compiles.

Now I'm stuck at:

- --- snip ---
/usr/bin/cxx -std strict_ansi -DHAVE_CONFIG_H -I. -I. -I../../src -I./../ 
-I../.. -I../../boost -I/net/usr/include -ptr /tmp/lyx_cxx_repository 
-I/net/usr/include -c -MD insetgraphics.C
cxx: Error: /usr/lib/cmplrs/cxx/V6.5-021/include/cxx/utility, line 197:
           extern inline function "std::make_pair(const T1 &, const T2 &) [with
           T1=std::string, T2=std::string]" was referenced but not defined
   inline pair<T1, T2> make_pair(const T1& x, const T2& y)
----------------------^
cxx: Info: 1 error detected in the compilation of "insetgraphics.C".
gmake[3]: *** [insetgraphics.lo] Error 1
gmake[3]: Leaving directory `/path/to/lyx-1.2.0/src/insets'
- --- snap ---

A cxx bug? (upgrade is not an option, this already is the latest version)


+Thomas

-- 
Thomas Anders <[EMAIL PROTECTED]>
Hahn-Meitner-Institut Berlin, Germany

Reply via email to