Crystal Space
Welcome, Guest. Please login or register.
October 30, 2014, 02:27:22 pm

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8882 Members
Latest Member: Susiesmith5
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  LNK2019 when using scfQueryInterface
« previous next »
Pages: [1] Print
Author Topic: LNK2019 when using scfQueryInterface  (Read 855 times)
Davidius
Newbie
*
Posts: 4


View Profile WWW Email
« on: March 20, 2010, 11:39:18 am »

Hi,
I wanted do create sprite2d by code. Thats my code (coded before I found this forum):

Code:
iTextureWrapper* txt = m_loader->LoadTexture ("seagull", "/lib/std/seagull.gif");
if (txt == 0)
{
//iReporter::ReportError("Error loading texture!");
}
iMaterialWrapper* tm = m_engine->GetMaterialList()->FindByName("seagull");

// First create the factory:
csRef<iMeshFactoryWrapper> fact = m_engine->CreateMeshFactory("crystalspace.mesh.object.sprite.2d", "sprite2d");
csRef<iSprite2DFactoryState> factstate = scfQueryInterface<iSprite2DFactoryState>(fact->GetMeshObjectFactory());

// Now create an instance:
csRef<iMeshWrapper> mesh = m_engine->CreateMeshWrapper(fact, "sprite2dm");
mesh->GetMeshObject()->SetMaterialWrapper(tm);
csRef<iSprite2DState> meshstate = scfQueryInterface<iSprite2DState>(mesh->GetMeshObject());
csSprite2DVertex v1;
v1.pos = csVector2(-0.5f * m_height, 0.5f * m_width);
v1.u = 0;
v1.v = 0;
v1.color = csColor(1, 1, 1);
v1.color_init = csColor(1, 1, 1);
meshstate->GetVertices()->Insert(0, v1);
csSprite2DVertex v2;
v2.pos = csVector2(-0.5f * m_height, -0.5f * m_width);
v2.u = 0;
v2.v = 1;
v2.color = csColor(1, 1, 1);
v2.color_init = csColor(1, 1, 1);
meshstate->GetVertices()->Insert(0, v2);
csSprite2DVertex v3;
v3.pos = csVector2(0.5f * m_height, -0.5f * m_width);
v3.u = 1;
v3.v = 1;
v3.color = csColor(1, 1, 1);
v3.color_init = csColor(1, 1, 1);
meshstate->GetVertices()->Insert(0, v3);
csSprite2DVertex v4;
v4.pos = csVector2(0.5f * m_height, 0.5f * m_width);
v4.u = 1;
v4.v = 0;
v4.color = csColor(1, 1, 1);
v4.color_init = csColor(1, 1, 1);
meshstate->GetVertices()->Insert(0, v4);
meshstate->SetLighting(false);
mesh->GetMovable()->SetSector(sector);
mesh->GetMovable()->SetPosition(csVector3(x, y, z));

following files are inlcuded
Code:
header file:
#include <cssysdef.h>
#include <csextern.h>
#include <imap/loader.h>
#include <iengine/engine.h>

source file:
#include <iengine/texture.h>
#include <iengine/material.h>
#include <iengine/mesh.h>
#include <imesh/sprite2d.h>
#include <iengine/movable.h>
#include <imesh/object.h>
#include <ivaria/reporter.h>

I'm using the Qt Framework with MSVC2005 (Cool to build the projekt. That's what I use to set up the Enviroment:
Code:
# crystalspace.pri
CRYSTALSPACEDIR = C:/Programme/crystalspace/1.4.0

DEFINES += CS_WIN32_CSCONFIG \
__CRYSTAL_SPACE__ \
CS_BUILD_SHARED_LIBS

debug {
DEFINES += CS_DEBUG
} else {
DEFINES += CS_RELEASE
}

win32 {
debug {
LIBS += $${CRYSTALSPACEDIR}/out/debug8/libs/libcrystalspace_d.lib
LIBS += $${CRYSTALSPACEDIR}/out/debug8/libs/libcrystalspace_directx_d.lib
LIBS += $${CRYSTALSPACEDIR}/out/debug8/libs/libcrystalspace_opengl_d.lib
LIBS += $${CRYSTALSPACEDIR}/out/debug8/libs/libcrystalspace_windows_d.lib
} else {
LIBS += $${CRYSTALSPACEDIR}/out/release8/libs/libcrystalspace.lib
LIBS += $${CRYSTALSPACEDIR}/out/release8/libs/libcrystalspace_directx.lib
LIBS += $${CRYSTALSPACEDIR}/out/release8/libs/libcrystalspace_opengl.lib
LIBS += $${CRYSTALSPACEDIR}/out/release8/libs/libcrystalspace_windows.lib
}
}

INCLUDEPATH += $${CRYSTALSPACEDIR}/include
debug {
INCLUDEPATH += $${CRYSTALSPACEDIR}/out/debug8/bin
} else {
INCLUDEPATH += $${CRYSTALSPACEDIR}/out/release8/bin
}
I hobe that it's easy readable enough.

The Path variable is set up correctly. The class is located in a library.
I used the same code in a test application and it works, but now I get the error LNK2019:
Code:
Sprite.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void (__cdecl* csStaticVarCleanup)(void (__cdecl*)(void))" (?csStaticVarCleanup@@3P6AXP6AXXZ@ZA)" in Funktion ""public: static unsigned long __cdecl scfInterfaceTraits<struct iSprite2DState>::GetID(void)" (?GetID@?$scfInterfaceTraits@UiSprite2DState@@@@SAKXZ)".

That means:
Sprite.obj : error LNK2019: unresolved external symbol ""void (__cdecl* csStaticVarCleanup)(void (__cdecl*)(void))" (?csStaticVarCleanup@@3P6AXP6AXXZ@ZA)" referenced in function ""public: static unsigned long __cdecl scfInterfaceTraits<struct iSprite2DState>::GetID(void)" (?GetID@?$scfInterfaceTraits@UiSprite2DState@@@@SAKXZ)".

Thank you
David
Logged
Davidius
Newbie
*
Posts: 4


View Profile WWW Email
« Reply #1 on: March 21, 2010, 12:41:47 pm »

Hi again,
Problem is solved ...

There where no CS_IMPLEMENT_FOREIGN_DLL makro used in this file.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 4.174 seconds with 16 queries.