Jump to content
  • Advertisement
Sign in to follow this  
EvilWeebl

Importing Engine.lib into other projects

This topic is 2549 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, up until now I've been a 1 project guy but am now creating an Engine into a lib to be used by other projects blah blah etc etc.

Any way for some reason the projects importing this are kicking up the following error:

error C2061: syntax error : identifier 'ID3DBlob'

with this line of code:

HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderMode, ID3DBlob** ppBlobOut); //Private function in Engine.h


If I take out ID3DBlob parameter it compiles fine until I call the function like so:

CompileShaderFromFile("blah.fx", "VS", "vs_4_0");


then I get:

Error 8 error LNK2019: unresolved external symbol "private: long __thiscall Engine::CompileShaderFromFile(wchar_t *,char const *,char const *)" (?CompileShaderFromFile@Engine@@AAEJPA_WPBD1@Z) referenced in function "private: void __thiscall Engine::InitPipeline(void)" (?InitPipeline@Engine@@AAEXXZ) C:...\NativeEngine_Sample\NativeGame\NativeEngineLib.lib(Engine.obj) NativeGame

Can anybody help me solve this and explain why its happening so I know for future reference?

Any help is much appreciated

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the quick reply.

Excuse my ignorance but which file? The engine.h file in my Engine lib or the files in the projects that are importing them?

Im sure ID3DBlob is under ID3DX11.h which is included in my Engine lib project and compiles fine, its just the projects that import it are complaining.

I presumed projects that imported the lib would also import the headers the lib is using, no? I have to #include all the headers again?

It seems in the Engine lib project's external Dependencies it has D3DX11.h (hence I can #include it) but other projects that import the Engine libs are lacking it(although amongst the list seems to be most other DX headers).

How do I add an external dependency? I'm sorry if these are brutally noobish questions but my experience is as much as starting a new project and going properties/include directory/ add DX. Also this solution was sent to me as a starting point and I have no idea how it was set up.

Share this post


Link to post
Share on other sites
Ok so I included the Directx include in the other projects and then included d3dx11.lib and the whole blobs error went away.

I should have been more specific about that second problem it wasn't my helper function it was having the problem with it turns out its this directx function it doesnt like.

D3DX11CompileFromFile(L"shaders.hlsl", NULL, NULL, "VShader", "vs_5_0", NULL, 0, NULL, &VS, NULL, NULL);


it seems to be producing these errors in the projects that are importing the lib:


error LNK2019: unresolved external symbol _D3DX11CompileFromFileW@44 referenced in function "private: void __thiscall Engine::InitPipeline(void)" (?InitPipeline@Engine@@AAEXXZ) C:...\NativeEngine_Sample\NativeGame\NativeEngineLib.lib(Engine.obj) NativeGame


error LNK1120: 1 unresolved externals

I've included just about every header that my lib uses such as d3d11.h, d3dx11.h, d3dcompiler.h, d3dcommon.h and yet still get same errors.

Any ideas?

Share this post


Link to post
Share on other sites
We can forget this ever happened, consider this discussion closed.

The libs weren't included in the linker *facepalm*

Thanks anyway

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!