Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Pages: [1] 2

Author Topic: build as DLL?  (Read 4297 times)

Arcanor

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 47
    • View Profile
    • http://arcanoria.com
build as DLL?
« on: February 02, 2007, 08:46:58 AM »

I can build the OIS_static_d.lib without problems in VC8.  But when I switch it to build a DLL I get lots of unresolved external symbol errors.  For example, here is a portion of my build log:

Code: [Select]
Linking...
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_ConstantForce
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_RampForce
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_SawtoothDown
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_SawtoothUp
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_Sine
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_Triangle
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_Square
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_Spring
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_Inertia
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_Damper
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_Friction
Win32ForceFeedback.obj : error LNK2001: unresolved external symbol _GUID_CustomForce
Win32InputManager.obj : error LNK2019: unresolved external symbol _DirectInput8Create@20 referenced in function "public: virtual void
__thiscall OIS::Win32InputManager::_initialize(class std::multimap,class
std::allocator >,class std::basic_string,class std::allocator >,struct
std::less,class std::allocator > >,class std::allocator,class std::allocator >
const ,class std::basic_string,class std::allocator > > > > &)"
(?_initialize@Win32InputManager@OIS@@UAEXAAV?$multimap@V?$basic_string
@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@
D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@
@@2@@std@@@Z)
Win32InputManager.obj : error LNK2001: unresolved external symbol
_IID_IDirectInput8A
Win32JoyStick.obj : error LNK2001: unresolved external symbol _c_dfDIJoystick2
Win32KeyBoard.obj : error LNK2001: unresolved external symbol _c_dfDIKeyboard
Win32KeyBoard.obj : error LNK2001: unresolved external symbol _GUID_SysKeyboard
Win32Mouse.obj : error LNK2001: unresolved external symbol _c_dfDIMouse2
Win32Mouse.obj : error LNK2001: unresolved external symbol _GUID_SysMouse
..\lib\OIS.dll : fatal error LNK1120: 19 unresolved externals


Is it possible for me to build as a DLL or do I have to use the SDK to do that?
Logged
Arcanoria - online medieval fantasy RPG - www.arcanoria.com

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
build as DLL?
« Reply #1 on: February 02, 2007, 08:57:35 AM »

There are only two things required when building OIS as a dll... or, well, maybe three things.

1) Make sure you built all OIS build targets. And that you have both a OIS_d.lib, OIS_d.dll, OIS.lib, OIS.dll in the ois/dll directory.
2) Make sure you are of course linking to the correct libs in the ois/dll directory
3) Make sure you define OIS_DYNAMIC_LIB either in code, before you include any OIS header files, or in your project settings for additional preprocessor defines.

The macro pulls in the dllimport attribute for when you need it as a dll ;)
Logged

Arcanor

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 47
    • View Profile
    • http://arcanoria.com
build as DLL?
« Reply #2 on: February 02, 2007, 09:12:32 AM »

The problem is that I *don't* have the OIS_d.lib, OIS_d.dll, OIS.lib, OIS.dll files.  I'm trying to create those for the v1.0RC1 build, since there's no SDK download available for it.  The only SDK I saw was for the 0.7.2 version.

Also, did you mean "ois/lib" directory when you were saying "ois/dll"?

Sorry, but I'm new to this and easily confused. ;)
Logged
Arcanoria - online medieval fantasy RPG - www.arcanoria.com

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
build as DLL?
« Reply #3 on: February 02, 2007, 09:15:35 AM »

ois/lib contains static libraries.
ois/dll contains import libs & dlls

Go to Build -> Batch Build -> Select all build targets (except 64 bit ones) -> rebuild all.

If you don't use batch build, the dlls won't get built.
Logged

Arcanor

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 47
    • View Profile
    • http://arcanoria.com
build as DLL?
« Reply #4 on: February 02, 2007, 09:38:21 AM »

Thanks for the remedial VC8 tutorial.  Sorry I'm a noob!  :oops:

Anyway, after attempting to build all targets I'm still getting the same errors.  I must be doing something wrong, but I don't want to waste more of your time on this.

Thanks for trying pjcast, but I think I'm going to just stick with the 0.7.2 version, since it has a pre-built sdk.
Logged
Arcanoria - online medieval fantasy RPG - www.arcanoria.com

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
build as DLL?
« Reply #5 on: February 02, 2007, 09:46:04 AM »

I think you missed point three above. You simply must define that OIS_DYNAMIC_LIB to use OIS as a DLL. Oh, and I can't really recommend sticking with 0.7.x versions, as several things have been fixed in the 1.0 version. Anyway, good luck :D
Logged

Arcanor

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 47
    • View Profile
    • http://arcanoria.com
build as DLL?
« Reply #6 on: February 02, 2007, 10:24:28 AM »

I don't think I missed #3.  What I did was change the project's Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions from:

WIN32;_DEBUG;_LIB;_STLP_DEBUG

to

WIN32;_DEBUG;_LIB;_STLP_DEBUG;OIS_DYNAMIC_LIB

Is that not what you meant?
Logged
Arcanoria - online medieval fantasy RPG - www.arcanoria.com

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
build as DLL?
« Reply #7 on: February 02, 2007, 11:15:53 AM »

Oh, hmm, I think I should have been paying more attention to your reported errors above. The methods that are listed as unresolved are all DirectInput methods, not OIS methods.

Do you have DirectX SDk installed? You need that to build OIS.
Logged

Arcanor

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 47
    • View Profile
    • http://arcanoria.com
build as DLL?
« Reply #8 on: February 02, 2007, 12:01:22 PM »

Yes, that was one of the first things I did when I installed VC8 last week.  I've been able to build Ogre 1.2.5 with my environment, for example.
Logged
Arcanoria - online medieval fantasy RPG - www.arcanoria.com

Arcanor

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 47
    • View Profile
    • http://arcanoria.com
build as DLL?
« Reply #9 on: February 02, 2007, 12:10:45 PM »

By the way, I'm using the Dec 2006 DirectX SDK, and in the default path:

libs - C:\Program Files\Microsoft DirectX SDK (December 2006)\Lib\x86

includes - C:\Program Files\Microsoft DirectX SDK (December 2006)\Include
Logged
Arcanoria - online medieval fantasy RPG - www.arcanoria.com

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
build as DLL?
« Reply #10 on: February 02, 2007, 12:36:03 PM »

This is somewhat odd. When you built OIS, can you build & run both the console demo & the ff console demo?

A workaround, is that you can link against the directinput libs yourself, which should most definitely remove this unresolved's from you app... But, using the dll, you shouldn't have too. Look at the OIS dll project settings for which DirectInput libs you need to link against. (I don't have VC in front of me at the moment).
Logged

Arcanor

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 47
    • View Profile
    • http://arcanoria.com
build as DLL?
« Reply #11 on: February 02, 2007, 01:45:09 PM »

When I build OIS as a static library I can run Demo_Console without a problem, but Demo_FFTest fails with a missing OIS_d.dll.

Fixing that...

Okay, I added:

PATH=..\..\dll

to Demo_FFTest's Configuration Properties -> Debugging -> Environment

And now both demos work, but only if I compile OIS as a .lib.  I still can't compile OIS as a .dll.

As far as additional dependencies on the DirectInput libraries, the only dependencies I see in OIS -> Configuration Properties -> Linker -> Input -> Additional Dependencies are OIS_D.lib and OIS.lib.  Is that where you meant me to look?
Logged
Arcanoria - online medieval fantasy RPG - www.arcanoria.com

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
build as DLL?
« Reply #12 on: February 02, 2007, 01:56:44 PM »

You should not have to change the paths at all for any of the demos, I have tested (as others have) all demos on different computers from clean installs several times.

Perhaps, if your code sample and project is small, just zip it up and email it to me, and I can sort out what is odd with your configuration pretty easily.
Logged

Arcanor

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 47
    • View Profile
    • http://arcanoria.com
build as DLL?
« Reply #13 on: February 02, 2007, 02:33:15 PM »

The code is exactly what I downloaded from your site. :)  I'm guessing some setting got botched somewhere, but I can't find anything wrong.

Emailed a zip to you.  Thanks. :)
Logged
Arcanoria - online medieval fantasy RPG - www.arcanoria.com

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
build as DLL?
« Reply #14 on: February 02, 2007, 03:30:06 PM »

Quote from: "Arcanor"
The code is exactly what I downloaded from your site. :)  I'm guessing some setting got botched somewhere, but I can't find anything wrong.

Emailed a zip to you.  Thanks. :)


Hmm, I don't see your email in my box :( You can also email me at pjcast@wreckedgames.com in addition to my email listed here. You are saying that it is the RC1 download of ois that you are sending me? I thought you had a small project of your own you were trying to integrate ois into. If it is the RC1 download, there should be nothing at all wrong with that. But, feel free to send me whatever you have anyway, and I'll see how it builds here.
Logged
Pages: [1] 2