When I compile this file
------------------------------------------------------
#include <stdarg.h>
template <class Any>
void var_arg_func(int dimension_count, ...)
{
int dimensions[4];
va_list ap;
va_start(ap, dimension_count); // <- error
for (int i = 0; i < 3; i++)
{
dimensions[i] = va_arg(ap,int); // <- error
}
}
------------------------------------------------------
I get the following obscure error message:
test.cpp:10: sorry, not implemented: initializer contains unrecognized
tree code
test.cpp:15: sorry, not implemented: initializer contains unrecognized
tree code
If I make the function to be non-templated, it compiles.
Either version compiles under MSVC++ 6.0.
I am using the gcc 2.7.2 that ships with Tornado 2.0 from
WindRiver.
Can anyone explain this error message?
I need to get this code to compile.
I have a templated class that I wrote that implements a
multi-dimensional container. Since it is a container it must be
templated.
Being multi-dimensional the functions that require an index use
the elipsis ... operator. 4 3231
"frankg" <Fr**********@motorola.com> wrote... When I compile this file ------------------------------------------------------ [...] ------------------------------------------------------ I get the following obscure error message: test.cpp:10: sorry, not implemented: initializer contains unrecognized
^^^^^^^^^^^^^^^^^^^^^^ tree code [...] I am using the gcc 2.7.2 that ships with Tornado 2.0 from WindRiver.
Can anyone explain this error message? I need to get this code to compile.
What word of "sorry, not implemented" do you not understand?
GCC has already progressed to the next major version. Perhaps
you need to update your compiler...
Victor
"frankg" wrote:
: When I compile this file
: ------------------------------------------------------
: #include <stdarg.h>
:
:
: template <class Any>
: void var_arg_func(int dimension_count, ...)
: {
: int dimensions[4];
: va_list ap;
:
: va_start(ap, dimension_count); // <- error
:
:
: for (int i = 0; i < 3; i++)
: {
: dimensions[i] = va_arg(ap,int); // <- error
: }
: }
: ------------------------------------------------------
: I get the following obscure error message:
: test.cpp:10: sorry, not implemented: initializer contains unrecognized
: tree code
: test.cpp:15: sorry, not implemented: initializer contains unrecognized
: tree code
:
: If I make the function to be non-templated, it compiles.
:
: Either version compiles under MSVC++ 6.0.
:
: I am using the gcc 2.7.2 that ships with Tornado 2.0 from
: WindRiver.
:
: Can anyone explain this error message?
: I need to get this code to compile.
:
: I have a templated class that I wrote that implements a
: multi-dimensional container. Since it is a container it must be
: templated.
: Being multi-dimensional the functions that require an index use
: the elipsis ... operator.
The code you posted assumes a set size of 3 integer arguments, so getting
that code to compile would be as simple as taking out the ellipses and
putting in an array argument and reading that. However, I don't think the
code you posted is what you want to actually compile (since your function is
parameterized but never uses the template parameter and the ellipses suggest
many possible numbers of arguments).
If the ellipses mean you just want to get passed a collection of values you
know are integers, just set a second argument of std::vector<int>, if they
are parametrized by the template, set a second argument of std::vector<Any>,
and if the arguments really must vary in type, you need to include a
descriptor argument which specifies what the format of those arguments are
and then you can try a std::vector<boost::any> or some other generic type
container. I am not sure why your code will not compile, but there seem to
be several alternate designs that might be more typesafe as well as being
more likely to compile.
--
/////////////////////////////////////////////
galathaea: prankster, fablist, magician, liar
> What word of "sorry, not implemented" do you not understand? GCC has already progressed to the next major version. Perhaps you need to update your compiler...
Victor
Thank you for your courteous response. I am forced to use this version
of gcc because Windriver ships binary objects without source. If I try
to move to a newer version of gcc that has different parameter passing
assumptions bad things will happen.
frankg wrote: What word of "sorry, not implemented" do you not understand?
GCC has already progressed to the next major version. Perhaps you need to update your compiler...
Victor
Thank you for your courteous response. I am forced to use this version of gcc because Windriver ships binary objects without source. If I try to move to a newer version of gcc that has different parameter passing assumptions bad things will happen.
I've never used C++ stuff in VxWorks, but there are folks around who
have switched to a never compiler with varying degrees of success.
You might try searching google. Also, you really are compiling
with g++ as opposed to gcc, aren't you? This is expecially important
if you are using a windows host as your development machine.
You might also call the local FAE and explain your specific
problem. They may have a workaround.
Speaking only for myself,
Joe Durusau This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Christophe Barbe |
last post by:
I posted a few days ago about the same problem but was not very clear. So
here is my second take at it.
Basically with GCC 3.3.2, I can't compile the example from the
C++ FAQ Lite available...
|
by: velthuijsen |
last post by:
I've been reading (and using the examples in) Thinking in C++ (vol 2).
One of the things that the author shows you can do with templates is
the following:
#include <iostream>
using namespace...
|
by: vpadial |
last post by:
Hello,
I want to build a library to help exporting c++ functions to a
scripting languagge. The scripting language provides a function to
register functions like:
ANY f0()
ANY f1(ANY)
ANY...
|
by: Levent |
last post by:
Hi,
Why doesn't this work? (tried with gcc 3.3.3 and VC++ 7.1):
#include <iostream>
template<class T, unsigned N>
struct Foo {
void func();
};
template<class T, unsigned N>
|
by: Ann Huxtable |
last post by:
I have the following code segment - which compiles fine. I'm just
worried I may get run time probs - because it looks like the functions
are being overloaded by the return types?. Is this Ok: ?
...
|
by: Douwe |
last post by:
I try to build my own version of printf which just passes all
arguments to the original printf. As long as I keep it with the single
argument version everything is fine. But their is also a version...
|
by: Hendrik Schober |
last post by:
Hi,
I have a problem with extending some existing code. In a simplified
form, the problem looks like this:
I have four types, A, B, C, and D. Each A refers to zero, one, or more
B's and each...
|
by: stinos |
last post by:
Hi All!
suppose a class having a function for outputting data somehow,
class X
{
template< class tType >
void Output( const tType& arg )
{
//default ToString handles integers/doubles
|
by: Pallav singh |
last post by:
Hi All,
i am getting error during explicit function Instantiation for a class
Template
if i do explicit Instantiation of class it work and all function
symbol i get in object file
But if i...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |