Re: Bison complains about undefined reference of my own data type

2008-11-28 Thread Samuel Tardieu
* Laurence Finston <[EMAIL PROTECTED]> [2008-11-28 17:10:27 +0100] | I'm sorry if I'm being obtuse. What are you doing differently and what | error message is one supposed to get? With extern "C": % g++ -o t t.cc [nothing printed, no error] Without extern "C": % g++ -o t t.cc /tmp/ccMxFapw.o

Re: Bison complains about undefined reference of my own data type

2008-11-28 Thread Samuel Tardieu
* Laurence Finston <[EMAIL PROTECTED]> [2008-11-28 15:48:02 +0100] | > You need to do it to interface to any library written in C (such as | > the standard C library for example). For example, try the following | > C++ code with and without 'extern "C"'. Without it, you won't be able | > to link.

Re: How to get the text corresponding to a bison rule

2008-11-28 Thread sgaurelius
It is easy to recover the number of the dimensions. But I want to find what are the dimensions as well. If I count the brackets, that won't give much of information will it ? Stratis Laurence Finston wrote: > >> Basically, I want to derive information from it. For example, if I got a >> matrix

Re: Bison complains about undefined reference of my own data type

2008-11-28 Thread Laurence Finston
On Fri, 28 Nov 2008, Samuel Tardieu wrote: > I wrote "this C++ code". It means that you must compile it with g++ (otherwise > it is valid C code), as well as link it with g++ (without deriving too much, > let me just say that g++ called in link mode does a bit more than linking -- > it takes car

Re: Bison complains about undefined reference of my own data type

2008-11-28 Thread Laurence Finston
> You need to do it to interface to any library written in C (such as > the standard C library for example). For example, try the following > C++ code with and without 'extern "C"'. Without it, you won't be able > to link. Fortunately, all your system headers already provide you with > 'extern "C"'

Re: How to get the text corresponding to a bison rule

2008-11-28 Thread Laurence Finston
> Basically, I want to derive information from it. For example, if I got a > matrix like [[1,2],[3,4]], I want to find the dimensions of it. It's not that difficult to do this sort of thing. I almost always call the object I pass to Bison along with the parameter for `yylex' `scanner_node' an

Re: Bison complains about undefined reference of my own data type

2008-11-28 Thread Samuel Tardieu
> "Laurence" == Laurence Finston <[EMAIL PROTECTED]> writes: Laurence> One thing you might have to look out for is "name-mangling" Laurence> which C++ compilers do. You might have to turn it off for C Laurence> code by specifying C-linkage, e.g., "extern "C" foo(void);". Laurence> I've never

Re: How to get the text corresponding to a bison rule

2008-11-28 Thread sgaurelius
Basically, I want to derive information from it. For example, if I got a matrix like [[1,2],[3,4]], I want to find the dimensions of it. The thing is, taht I had already a pretty good function for doing this, when I had manipulating the expression without bison. now with bison, if I want to the sa

Re: How to get the text corresponding to a bison rule

2008-11-28 Thread Laurence Finston
On Fri, 28 Nov 2008, sgaurelius wrote: > Flex scanner has previously analyzed the string and extracted the tokens. > However, if I want the text that corresponds to this expression, for example > the "(1+2)" and not just the tokens, what should I do ? Is there some > solution ? Save `yytext' som

Re: Bison complains about undefined reference of my own data type

2008-11-28 Thread Laurence Finston
On Fri, 28 Nov 2008, sgaurelius wrote: > Finally, it was somthing really easy and stupid and had nothing to dowith > bison. I just was worred, because I don't know how much compatible C and C++ > code can be. A linker should be able to link object files no matter what language was used to pro

How to get the text corresponding to a bison rule

2008-11-28 Thread sgaurelius
Hi! Let's say I have the rule paren: '(' expression ')' { } Flex scanner has previously analyzed the string and extracted the tokens. However, if I want the text that corresponds to this expression, for example the "(1+2)" and not just

Re: Bison complains about undefined reference of my own data type

2008-11-28 Thread sgaurelius
Finally, it was somthing really easy and stupid and had nothing to dowith bison. I just was worred, because I don't know how much compatible C and C++ code can be. Thanks for the help anyway :) Vukki Starborn wrote: > > 2008/11/24 sgaurelius <[EMAIL PROTECTED]> > >> >> >> Do you have any gui