Compiler error

Hello, i’m using collada_dom 1.4.1, including this files in my application


#include <dae.h>
#include <dom/domCOLLADA.h>
#include <dom/domConstants.h>

When i try to use this code


		domProfile_COMMON *eff;
		collada_dom->getDatabase()->getElement((daeElement**)&eff,0,0,COLLADA_TYPE_PROFILE_COMMON,0);
		{		
			domAmbientRef Amb = eff->getTechnique()->getBlinn()->getAmbient();
			Amb->getColor()->getValue().get3at(0,this->ColladaBuffer.Mats.Ambient.r,this->ColladaBuffer.Mats.Ambient.g,this->ColladaBuffer.Mats.Ambient.b);
			this->ColladaBuffer.Mats.Ambient.a = Amb->getColor()->getValue()->get(3);
		}	


I receive a lot of errors:

Error 22 error C2027: use of undefined type ‘domProfile_COMMON’ c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 448
Error 21 error C2065: ‘Amb’ : undeclared identifier c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 448
Error 26 error C2065: ‘Amb’ : undeclared identifier c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 449
Error 30 error C2065: ‘Amb’ : undeclared identifier c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 450
Error 19 error C2065: ‘domAmbientRef’ : undeclared identifier c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 448
Error 20 error C2146: syntax error : missing ‘;’ before identifier ‘Amb’ c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 448
Error 33 error C2227: left of ‘->get’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 450
Error 25 error C2227: left of ‘->getAmbient’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 448
Error 24 error C2227: left of ‘->getBlinn’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 448
Error 27 error C2227: left of ‘->getColor’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 449
Error 31 error C2227: left of ‘->getColor’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 450
Error 23 error C2227: left of ‘->getTechnique’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 448
Error 28 error C2227: left of ‘->getValue’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 449
Error 32 error C2227: left of ‘->getValue’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 450
Error 29 error C2228: left of ‘.get3at’ must have class/struct/union c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 449

All seems to start from domprofile_COMMON, but i do not know how to proceed…
Can you help mep please?

In C if it says you have an undefined type it usually means you’re missing a #include. In your case you want #include <dom/domProfile_COMMON.h>.

Oh…then the file is not included automatically in domCOLLADA.h?

I’ve got another problem :smiley:
I’ve included the file, now the part works, but now i’ve got other problems:


			domAmbientRef Amb = eff->getTechnique()->getBlinn()->getAmbient();
			Amb->getColor()->getValue().get3at(0,this->ColladaBuffer.Mats.Ambient.r,this->ColladaBuffer.Mats.Ambient.g,this->ColladaBuffer.Mats.Ambient.b);
			this->ColladaBuffer.Mats.Ambient.a = Amb->getColor()->getValue()->get(3);

I receive this error

Error 26 error C2228: left of ‘.get3at’ must have class/struct/union c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 459
Error 25 error C2227: left of ‘->getValue’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 459
Error 29 error C2227: left of ‘->getValue’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 460
Error 24 error C2227: left of ‘->getColor’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 459
Error 28 error C2227: left of ‘->getColor’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 460
Error 30 error C2227: left of ‘->get’ must point to class/struct/union/generic type c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 460
Error 21 error C2146: syntax error : missing ‘;’ before identifier ‘Amb’ c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 457
Error 20 error C2065: ‘domAmbientRef’ : undeclared identifier c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 457
Error 22 error C2065: ‘Amb’ : undeclared identifier c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 457
Error 23 error C2065: ‘Amb’ : undeclared identifier c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 459
Error 27 error C2065: ‘Amb’ : undeclared identifier c:\users\vincenzo\documents\visual studio 2008\projects\colladameshloading\colladameshloading\loadmesh.h 460

I’ve also included domlight.h

domAmbientRef is a nested class in domTechnique_common, which is a nested class in domLight. So it would be

domLight::domTechnique_common::domAmbientRef Amb = …

You could shorten it with a typedef:

typedef domLight::domTechnique_common::domAmbientRef domAmb;
domAmb amb = …

Steve

Thank you it works, but now i’ve got another problem.


domLight::domTechnique_common::domAmbientRef Amb = eff->getTechnique()->getBlinn()->getAmbient();

This gives me a compiler error:

Error 24 error C2440: ‘initializing’ : cannot convert from ‘domCommon_color_or_texture_type *’ to ‘domLight::domTechnique_common::domAmbient *’ c:\users\vincenzo\documents\visual studio 2008\projects\colladadom\include\dae\daesmartref.h 44

I tried also daesafecast but it does not works. Is this the right way to get the material floats value?

You need to be willing to open up header files and look at the function declarations if you’re going to make any progress. domBlinn::getAmbient returns a domFx_common_color_or_texture_type object, which has a getColor method. getBlinn()->getAmbient()->getColor().