compilation problem with mingw

A

alessio211734

I am trying to port my code on mingw compiler.Until now I use visual
studio compiler. I get some problem with template:
for example this template function call give my an error:

error: parse error in template argument list
error: no matching function for call to
'vcg::Add_Ons::glArrow(vcg::point3f&, vcg::point3f&, float&, float&,
float&, int&, int&, bool&)'


********** this is my code: *****************


Point3f tail;
Point3f head;

float body_width=0;
float head_width=0;
float head_lenght=0;
int body_slice=10;
int head_slice=10;
bool useDisplList=true;

/********************* template function call that generate the
error!!!!!! *****************************/
Add_Ons::glArrow<Add_Ons::DrawMode::DMSolid>(tail, head, body_width,
head_lenght,
head_width, body_slice, head_slice,
useDisplList);



************ template definition ********************


namespace vcg
{
....
class Add_Ons
{
public:
enum DrawMode {DMUser,DMWire,DMSolid} ;
....
template <DrawMode dm>
static void glArrow(Point3f tail, Point3f head,float
body_width,float head_lenght,
float head_width,int body_slice=10,int head_slice=10,bool
useDisplList=true)
{
....
}

}
}





Thanks in advance.
 
V

Victor Bazarov

I am trying to port my code on mingw compiler.Until now I use visual
studio compiler. I get some problem with template:
for example this template function call give my an error:

error: parse error in template argument list
error: no matching function for call to
'vcg::Add_Ons::glArrow(vcg::point3f&, vcg::point3f&, float&, float&,
float&, int&, int&, bool&)'


********** this is my code: *****************
[..]

I couldn't compile your code either with vc++ or with mingw, probably
because it wasn't complete. Try FAQ 5.8.

V
 
N

Narinder

I am trying to port my code on mingw compiler.Until now I use visual
studio compiler. I get some problem with template:
for example this template function call give my an error:

error: parse error in template argument list
error: no matching function for call to
'vcg::Add_Ons::glArrow(vcg::point3f&, vcg::point3f&, float&, float&,
float&, int&, int&, bool&)'

********** this is my code: *****************

  Point3f tail;
  Point3f head;

  float body_width=0;
  float head_width=0;
  float head_lenght=0;
  int body_slice=10;
  int head_slice=10;
  bool useDisplList=true;

/********************* template function call that generate the
error!!!!!! *****************************/
  Add_Ons::glArrow<Add_Ons::DrawMode::DMSolid>(tail, head, body_width,
head_lenght,
                           head_width, body_slice, head_slice,
useDisplList);

************ template definition ********************

namespace vcg
{
...
   class Add_Ons
        {
        public:
                enum DrawMode  {DMUser,DMWire,DMSolid} ;
...
template <DrawMode dm>
                        static void glArrow(Point3f tail, Point3f head,float
body_width,float head_lenght,
                        float head_width,int body_slice=10,int head_slice=10,bool
useDisplList=true)
                {
...
                }

       }

}

Thanks in advance.

try :
Add_Ons::template glArrow<Add_Ons::DrawMode::DMSolid>(tail, head,
body_width,head_lenght,head_width, body_slice, head_slice,
useDisplList);
 
N

Narinder

I am trying to port my code on mingw compiler.Until now I use visual
studio compiler. I get some problem with template:
for example this template function call give my an error:
error: parse error in template argument list
error: no matching function for call to
'vcg::Add_Ons::glArrow(vcg::point3f&, vcg::point3f&, float&, float&,
float&, int&, int&, bool&)'
********** this is my code: *****************
[..]

I couldn't compile your code either with vc++ or with mingw, probably
because it wasn't complete.  Try FAQ 5.8.

V


template <DrawMode dm>
static void glArrow(Point3f tail, Point3f head,float body_width,float
head_lenght,float head_width,int body_slice=10,int head_slice=10,bool
useDisplList=true)


What does 'template<DrawMode dm>' mean ... I wouldn understand
'template<class dm>' ?
 
V

Victor Bazarov

I am trying to port my code on mingw compiler.Until now I use visual
studio compiler. I get some problem with template:
for example this template function call give my an error:
error: parse error in template argument list
error: no matching function for call to
'vcg::Add_Ons::glArrow(vcg::point3f&, vcg::point3f&, float&, float&,
float&, int&, int&, bool&)'
********** this is my code: *****************
[..]

I couldn't compile your code either with vc++ or with mingw, probably
because it wasn't complete. Try FAQ 5.8.

V


template<DrawMode dm>
static void glArrow(Point3f tail, Point3f head,float body_width,float
head_lenght,float head_width,int body_slice=10,int head_slice=10,bool
useDisplList=true)


What does 'template<DrawMode dm>' mean ... I wouldn understand
'template<class dm>' ?

It's a non-type template argument. Get a decent book on templates and
study, you're going to understand much more after that.

V
 
N

Narinder

On 7/15/2011 5:25 AM, alessio211734 wrote:
I am trying to port my code on mingw compiler.Until now I use visual
studio compiler. I get some problem with template:
for example this template function call give my an error:
error: parse error in template argument list
error: no matching function for call to
'vcg::Add_Ons::glArrow(vcg::point3f&, vcg::point3f&, float&, float&,
float&, int&, int&, bool&)'
********** this is my code: *****************
[..]
I couldn't compile your code either with vc++ or with mingw, probably
because it wasn't complete.  Try FAQ 5.8.
V
template<DrawMode dm>
static void glArrow(Point3f tail, Point3f head,float body_width,float
head_lenght,float head_width,int body_slice=10,int head_slice=10,bool
useDisplList=true)
What does 'template<DrawMode dm>' mean ... I wouldn understand
'template<class dm>' ?

It's a non-type template argument.  Get a decent book on templates and
study, you're going to understand much more after that.

V

...err .. yes thankyou .. I missed the enum at the top of the class at
first reading ....
 
A

alessio211734

I tried to replace with:

Add_Ons::template glArrow<Add_Ons::DrawMode::DMSolid>(tail, head,
body_width,head_lenght,head_width, body_slice, head_slice,
useDisplList);

it doesn't work!

report this errors:

error: 'template' (as a disambiguator) is only allowed within
templates
error: parse error in template argument list
error: no matching function for call to
'vcg::Add_Ons::glArrow(vcg::point3f&, vcg::point3f&, float&, float&,
float&, int&, int&, bool&)'
 
A

alessio211734

I modified the code as follow:

class Add_Ons
{
public:
//enum DrawMode {DMUser=0,DMWire=1,DMSolid=2} ;


template <int dm>
//template <class DrawMode>
static void glArrow(Point3f tail, Point3f head,float
body_width,float head_lenght,
float head_width,int body_slice=10,int
head_slice=10,bool useDisplList=true)
{
if (tail!=head)
{

}
}
};


in main program I call:

Add_Ons::glArrow<1>(tail, head, body_width, head_lenght,
head_width, body_slice, head_slice,
useDisplList);


In this way the code compiles, it seems that the problem is related to
the enumerations. Maybe mingw doesn't support enumeration as non-type
template argument?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top