SMaterial Error

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Fhqwhgads
Posts: 42
Joined: Tue Jun 21, 2005 1:43 am

SMaterial Error

Post by Fhqwhgads »

Okay I get this error...
(206) : error C2228: left of '.Texture1' must have class/struct/union type
(207) : error C2228: left of '.Lighting' must have class/struct/union type
for this code...

Code: Select all

SMaterial* loadTexture(char* name){
	SMaterial *texture;
	texture.Texture1 = Driver->getTexture(name);
	texture.Lighting = true;
	return texture;
}
Any ideas?
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Code: Select all

SMaterial* loadTexture(char* name){ 
   SMaterial* texture = new SMaterial();
   texture->Texture1 = Driver->getTexture(name); 
   texture->Lighting = true; 
   return texture; 
} 
Image
Fhqwhgads
Posts: 42
Joined: Tue Jun 21, 2005 1:43 am

Post by Fhqwhgads »

oooah. Ok that makes sense! That fixed that error. But now I get this error :P

Code: Select all

LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library

RGame_Main.obj : error LNK2001: unresolved external symbol "class irr::scene::IAnimatedMesh * __cdecl loadModel(char *,struct irr::video::SMaterial *,class irr::scene::IAnimatedMeshSceneNode *)" (?loadModel@@YAPAVIAnimatedMesh@scene@irr@@PADPAUSMate
rial@video@3@PAVIAnimatedMeshSceneNode@23@@Z)
Release/RGame.exe : fatal error LNK1120: 1 unresolved externals
I have no idea what that means. I am using msvc++6
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

not linking to right correct .lib.

have you changed the engine and recompiled it?
Image
Fhqwhgads
Posts: 42
Joined: Tue Jun 21, 2005 1:43 am

Post by Fhqwhgads »

Nope. Haven't touched the code at all. Is there a lib file I need? The game worked fine as is befor I added this code.
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

use /NODEFAULTLIB:library
The answer's right there, just tell your compiler to ignore LIBCMT
FlyHigh
Posts: 111
Joined: Wed Mar 23, 2005 12:05 am

Post by FlyHigh »

pfo wrote:
use /NODEFAULTLIB:library
The answer's right there, just tell your compiler to ignore LIBCMT
Thats the warning not the error. I wouldn't suggest using switches just because the compiler tells you to. (As in this it its a hack round a problem that doesn't exist, not the solution)

As for your error you need to link the library correctly, either through project settings or a pragma statement, see tutorial 1 for more details.
Fhqwhgads
Posts: 42
Joined: Tue Jun 21, 2005 1:43 am

Post by Fhqwhgads »

Okay, fixed the warning. I added Irrlicht.lib to the list of librarys but that didn't work. and I have the #pragma in my code.
Fhqwhgads
Posts: 42
Joined: Tue Jun 21, 2005 1:43 am

Post by Fhqwhgads »

Okay..I think I figured it out.

When you load a texture through Driver->getTexture() you need to load it into material.Texture1and inside my function I was returning SMaterial when I needed to be returning ITexture type.
Guest

Post by Guest »

you should read some c++ tutorials/books before you start writing 3d games....
Fhqwhgads
Posts: 42
Joined: Tue Jun 21, 2005 1:43 am

Post by Fhqwhgads »

...

I have. I have c++ for dummies because I am a dummie(if you couldn't tell form my posts). I recoded my whole project(an read in my devblog..in my sig) just to get into a OOP structure.

Only reason why I post about these errors is becuase I know c++, I jsut don't code often enough to reconize the errors. But now I know what the errors mean and how to fix them, and how to look them up on MSDN.
Post Reply