Visual C++ 2005 Express problem

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.
IRRer

Visual C++ 2005 Express problem

Post by IRRer »

hi there,

i'm about to explode...soon. It's my 100000000000th aproach using VC++2005 Express Ed. with no luck.

Whenever being inside a loop, VC is complaining about not knowing some Variables defined ONE line above

Example:

Code: Select all

...
  IAnimatedMesh* mesh = 0;
  ISceneNode* node = 0;
  mesh = pCore->getSceneMgr()->getMesh(pFileName);

  if (mesh)
    node =   pCore->getSceneMgr()->addOctTreeSceneNode(mesh->getMesh(0));
    node->setPosition(pos);
....
In the above code snipped VC is telling me:
..\..\entity.cpp(29) : error C2065: 'node' : undeclared identifier

Maybe I'm blinded by the light or something, but i do NOT see a SINGLE problem with it. It's just a little pointer, pointing to nothing...that's it. :evil:
The "funny" thing is all the code is working like a charm when using Codeblocks with gcc or even vc2003 Toolkit. BUT i want to use VC2005 cause i like the IDE...it's so comfortable :)

I'd be nice if anybody could enlighten me 8)
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

It's not MSVC's fault. It's the way you're declaring your nodes (me thinks).

try them out this way:(in this case for a .X model called "alien")

Code: Select all

scene::IAnimatedMesh* alienmesh = 0;
	alienmesh = smgr->getMesh("./data/alien.x");
	smgr->getMeshManipulator()->makePlanarTextureMapping(alienmesh->getMesh(0), 0.008f);	
	scene::IAnimatedMeshSceneNode* aliennode = 0;
	aliennode = smgr->addAnimatedMeshSceneNode(alienmesh);
	aliennode->setScale(vector3df(2, 2, 2));
	aliennode->setPosition(core::vector3df(2000,220,-60));
	aliennode->setRotation(core::vector3df(0,270,0));
	
ps. remember to adjust paths and file names according to yours. :wink:
Guest

Post by Guest »

Hi afecelis,

when using addOctTreeSceneNode i need an ISceneNode, not IAnimatedMeshSceneNode.

What i don't understand is, why it is not working in VC but in Codeblocks with NO little error or warning. It's not the first time i got problems with VC. Once i implemented a LinkedList....as above working like a charm with codeblocks and g++ but errors with VC...looks like VC is losing pointer or whatever^^


thx anyway :D
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

well, I've also tried it with octtrees (IsceneNodes) and it works:

Code: Select all

scene::IAnimatedMesh* mesh;
    mesh = smgr->getMesh("./data/boxes.my3d");
    scene::ISceneNode* test_scene = smgr->addOctTreeSceneNode(mesh->getMesh(0));
    test_scene->setPosition( irr::core::vector3df(0,0,0) );
    test_scene->setScale( irr::core::vector3df(1,1,1) );
    test_scene->setRotation( irr::core::vector3df(0,0,0) );
    test_scene->setMaterialFlag(video::EMF_LIGHTING, true);
ps. Tested on MSVC 7,8, Toolkit, GCC, with both Codeblocks and Devc++ IDEs
Guest

Post by Guest »

ohhhh, new error:

i only swapped 2 lines, and it is compiling fine, but then i get a runtime error

before:

Code: Select all

  IAnimatedMesh* mesh = 0;
  ISceneNode* node; //swapping with line below
  mesh = pCore->getSceneMgr()->getMesh(pFileName);
after:

Code: Select all

  IAnimatedMesh* mesh = 0;
  mesh = pCore->getSceneMgr()->getMesh(pFileName);
  ISceneNode* node; //SWITCHED
the error is this: Parent CXX0030: Error: expression cannot be evaluated
:shock:

when moving the ISceneNode* node; inside the if-loop:

Code: Select all

 IAnimatedMesh* mesh = 0;
 mesh = pCore->getSceneMgr()->getMesh(pFileName);
 
  if (mesh)
  ISceneNode* node = pCore->getSceneMgr()->addOctTreeSceneNode(mesh->getMesh(0));
VC tells me node is undefined?! Slowly i am really thinking VC is not ISO-conform or has problems with pointers

One more error and i'm using gcc again, cause it is working as supposed
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

mmmmmmmmmmh... you might be right. I read something somewhere around about MSVC 2005 express not being totally ISO compliant. But I've enver had a problem with my projects. If you want I can uplaod one of them with the MSVC project file for you to check it up :wink:
Guest

Post by Guest »

HAHAHA,

i took a look at the debug output window and it's telling:

Run-Time Check Failure #3 - The variable 'node' is being used without being defined.

OK, VC OBVIOUSLY doesn't have a short-term memory, because i get this kind of error always when using pointers, whereas gcc has no problem at all.

Ehmm...is VC2005 Express actually compatible with Windows 2000 ?
Maybe thats the problem, or there is something seriously messed up with the installation :evil:
Guest

Post by Guest »

afecelis wrote:....If you want I can uplaod one of them with the MSVC project file for you to check it up :wink:
if you don't mind. i could try them just to see if it is my installation.

Anyways, gcc is much more cooler.
The only thing i REALLY like with VC is the IDE...too sad it is not possible to use another compiler with it.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

you could also try Codeblocks; it works great with both MSVC toolkit 2003 and GCC.
Zipping up a project and uploading to my ftp.
The variable 'node' is being used without being defined.
ps. You had forgotten to clean your project before rebuilding it when you changed those lines, so yup, MSVC still had some traces going on in its memory
:wink:
Guest

Post by Guest »

no, cleaned up project and rebuild solution, but problem is still there....whatever, i'm using codeblocks and gcc again. Yes, Codeblocks rocks rocks rocks da socks^^*rapping*
Guest

Post by Guest »

lol...ok in THAT case it wasn't VC fault, i just forgot to put braces

Code: Select all

  if (mesh)
  {
    node = pCore->getSceneMgr()->addOctTreeSceneNode(mesh->getMesh(0));
    node->setPosition(pos);
  }
the best part is following. With the code above it compiles fine, BUT now it's telling
Parent CXX0030: Error: expression cannot be evaluated inside the ISceneNode.h

That was my last try...VC sucks forever *spitonit*

BTW: where is your ftp located afecelis?
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

project uploaded! perhaps not the smallest one but you'll find lots of thingies in it to play around with :wink:
http://afecelis.gdlib.net/Irrlicht/Temple.zip

ps. this is my newest space that a generous Irrlicht soul opened for me :wink: so I'm now mirroring my stuff there.
My original ftp depot is here:
http://www.danielpatton.com/afecelis

most of my stuff is still there, only that I'm trying to make things cleaner at gdlib. :D
Guest

Post by Guest »

sorry to say that, but the archive is corrupt :(
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

ouch! you mean corrupt as in the .zip is corrupt and won't open? Or as some files of the project are not loading correctly?

I'm downloading the file to check it. If there's any prob I'll reupload it. It might be something to do with zipping it in linux...dunno. Just gimme 5 to check the file :wink:
Guest

Post by Guest »

dont panic! :)

the zip archive itself is corrupt.
Post Reply