[Ecls-list] Compilation Error With Compiler-Generated Header and C++

Keith Sutton kesutt at gmail.com
Fri Feb 20 05:02:32 UTC 2009

g++ gives an error when compiling ecl-compiler-generated files.

foo.h:25: error: uninitialized const 'compiler_cfuns'
foo.c:14: error: redefinition of 'const ecl_cfun compiler_cfuns []'
foo.h:25: error: 'const ecl_cfun compiler_cfuns [1]' previously declared here

In C the compiler_cfuns[] in the header is simply a forward
declaration, but in C++ it counts as a definition without an
initializer which is an error.  It compiles in both C and C++ if the
declaration/definiton of compiler_cfuns is left out of the header.

Mac OS 10.5.6
ECL 8.12.0
g++ 4.0.1

Minimal example:

(defun foo () "foo")

Then do the following in ecl:

(require 'cmp)
(setq compiler:*cc* "g++")
(compile-file "foo.lisp" :system-p t :c-file t :h-file t :data-file t)

Keith Sutton

More information about the ecl-devel mailing list