Welcome to the CHICKEN Scheme pasting service

bind doesn't work pasted by kkrev on Tue Jul 17 03:45:17 2012

--test-foos.scm-----
(require-extension bind coops cplusplus-object)

(bind "#include \"foo.h\"")

(define x (make-instance <Foo> 99))
(print (getX x))              ; prints ''99''
(setX x 42)
(print (getX x))              ; prints ''42''
(destroy x)
--------------
--foo.h----
#ifndef _FOO_H_
#define _FOO_H_

class Foo {
private:
    Foo();
    int x_;
public:
    Foo(int x);
    void setX(int x);
    int getX();
};

#endif
--------------
--foo.cpp----
#include "foo.h"

Foo::Foo(int x) : x_(x)
{
}

void Foo::setX(int x)
{
    x_ = x;
}

int Foo::getX()
{
    return x_;
}
--------------

$ g++ -c foo.cpp
$ csc test-foo.scm foo.o -c++
test-foo.cpp: In function ‘long int stub227(long int, long int):
test-foo.cpp:37:1: error: ‘Foo’ was not declared in this scope
test-foo.cpp:37:6: error: ‘g62’ was not declared in this scope
test-foo.cpp:37:16: error: expected primary-expression before ‘)’ token
test-foo.cpp:37:17: error: expected ‘;’ before ‘C_c_pointer_or_null’
test-foo.cpp: In function ‘long int stub161(long int, long int, long int):
test-foo.cpp:48:1: error: ‘Foo’ was not declared in this scope
test-foo.cpp:48:6: error: ‘g58’ was not declared in this scope
test-foo.cpp:48:16: error: expected primary-expression before ‘)’ token
test-foo.cpp:48:17: error: expected ‘;’ before ‘C_c_pointer_or_null’
test-foo.cpp: In function ‘long int stub130(long int, long int):
test-foo.cpp:61:41: error: expected type-specifier before ‘Foo’
test-foo.cpp:61:41: error: expected ‘)’ before ‘Foo’
test-foo.cpp: In function ‘long int stub103(long int, long int):
test-foo.cpp:68:1: error: ‘Foo’ was not declared in this scope
test-foo.cpp:68:6: error: ‘t0’ was not declared in this scope
test-foo.cpp:68:15: error: expected primary-expression before ‘)’ token
test-foo.cpp:68:16: error: expected ‘;’ before ‘C_c_pointer_or_null’
test-foo.cpp:69:11: error: type ‘<type error>’ argument given to ‘delete’, expected pointer

Error: shell command terminated with non-zero exit status 256: g++ test-foo.cpp -o test-foo.o -c -Wno-write-strings -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -I"/usr/include/chicken"

Corrections added by dukzcry on Sat Jul 21 00:18:01 2012

Use bind* instead of bind to embed include directive (so Foo definition will be seen at compile stage).
And info on cplusplus-object's methods is outdated in bind documentation, replace accordingly:
make-instance -> new
destroy -> delete .

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the procedure that returns the car of a cdr?
Visually impaired? Let me spell it for you (wav file) download WAV