• 10
• 10
• 12
• 12
• 14

# Setting up SteamWorks API in Code::Blocks... am I missing something obvious?

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

## Recommended Posts

I recently had an idea for a quick little game and decided that I could use the idea to experiment with the Steamworks API in case I ever decided to release it or a future title on Steam. So, I logged into the Steamworks website, accepted their license agreement, and downloaded the SDK. After extracting it, I tried to link it in Code::Blocks. At the top if the "getting started" page, it lists three things you need to do to implement the SDK:

1. Include steam_api.dll in the runtime directory or search path.
2. Include the library steam_api.lib in the project.
3. Include steam_api.h in C++.

I did all those things, as well as include the directories containing these files in the appropriate search directory lists. When I compile, however, I get a long lists of very similar errors. Here's an example of one of the errors (the others are the same type of error but refer to different functions in different classes):

C:\Users\Jonah\Code Libraries\SteamWorks\sdk\public/steam/isteammusic.h: In static member function 'static bool VolumeHasChanged_t::GetMemberVariable(uint32, uint32&, uint32&, uint32&, const char**, const char**)':
C:\Users\Jonah\Code Libraries\SteamWorks\sdk\public/steam/isteammusic.h:62:1: error: no matching function for call to 'VolumeHasChanged_t::GetMemberVar_0(uint32&, uint32&, uint32&, const char**&, const char**&)'
C:\Users\Jonah\Code Libraries\SteamWorks\sdk\public/steam/isteammusic.h:62:1: note: candidate is:
C:\Users\Jonah\Code Libraries\SteamWorks\sdk\public/steam/isteammusic.h:61:1: note: static void VolumeHasChanged_t::GetMemberVar_0(unsigned int&, unsigned int&, uint32&, const char**, const char**)
C:\Users\Jonah\Code Libraries\SteamWorks\sdk\public/steam/isteammusic.h:61:1: note:   no known conversion for argument 1 from 'uint32 {aka long unsigned int}' to 'unsigned int&'
In file included from C:\Users\Jonah\Code Libraries\SteamWorks\sdk\public/steam/steam_api.h:24:0,
from C:\Users\Jonah\Documents\Game Development\Twenty Paces\Twenty Paces\main.cpp:2:



My program is a stock SFML example program which opens a window with a static image. The only change I've made is adding "#include <steam/steam_api.h>" at the top of the file, just to see if it would compile. My compiler is MinGW GCC, which came packaged with C::B.

I've tried for hours and can't figure out what I'm doing wrong. Am I missing something obvious? Is Steamworks just not compatible with my compiler? Is there some extra setting I have to change? I'm well and truly stumped. Any help is much appreciated.

##### Share on other sites

It sounds like in line 24 of steam_api.h, the functioncall VolumeHasChanged_t::GetMemberVar_0() is expecting a reference, but is being given a literal?

However, the more likely problem is that steam_api.dll / steam_api.lib is a MSVC-compiled library, and MinGW cannot link to that. Normally for libraries, you have to compile the libraries yourself to make sure each one of your libraries was not only compiled with the same compiler, but also the same compiler settings (debug/release, multithreaded, exceptions implementation (dw2 vs sjlj, with GCC), 32 bit vs 64 bit, etc..., etc...). Because of the minor nuisances between compatibility, I find it easier to assume I need to compile each library myself to ensure it all works.

SteamWorks doesn't have a source version you can compile yourself? But you can't actually answer that, because the agreement you agreed to when you downloaded the library likely prevents you from sharing most of the details about the library.

##### Share on other sites

It sounds like in line 24 of steam_api.h, the functioncall VolumeHasChanged_t::GetMemberVar_0() is expecting a reference, but is being given a literal?

However, the more likely problem is that steam_api.dll / steam_api.lib is a MSVC-compiled library, and MinGW cannot link to that. Normally for libraries, you have to compile the libraries yourself to make sure each one of your libraries was not only compiled with the same compiler, but also the same compiler settings (debug/release, multithreaded, exceptions implementation (dw2 vs sjlj, with GCC), 32 bit vs 64 bit, etc..., etc...). Because of the minor nuisances between compatibility, I find it easier to assume I need to compile each library myself to ensure it all works.

SteamWorks doesn't have a source version you can compile yourself? But you can't actually answer that, because the agreement you agreed to when you downloaded the library likely prevents you from sharing most of the details about the library.

Yeah, it seems that Steamworks requires Visual C++, which is a pain in the rear because Microsoft doesn't distribute it without the entire Visual Studio IDE. I'm downloading the free version now, and hopefully I can get it to work with that. I'm also betting that whatever version of SFML I have doesn't work with MSVC and I'll have to reinstall that as well. Yaaaay.

##### Share on other sites

which is a pain in the rear because Microsoft doesn't distribute it without the entire Visual Studio IDE

What do you mean by that?

##### Share on other sites

Just and addition..CodeBlocks is capable of using the MSVC toolchain( provided its already installed ).

##### Share on other sites

I'm also betting that whatever version of SFML I have doesn't work with MSVC and I'll have to reinstall that as well. Yaaaay.

That should not be a problem. It is *VERY* easy to get SFML up and running on MSVC, since they offer binary packages for MSVC 2010/2012/2013, both 32-bit and 64-bit, on their download page.

Should you be using MSVC2013, you don't even need to set up your project from scratch. I have attached an SFML2 project template: create an environment variable called SFML2_HOME and point it to where you unzipped the binary package, copy the template into the Documents\Visual Studio 2013\Templates\ProjectTemplates\Visual C++ Project folder, and you're done (it even copies the DLLs to the output folder for you). Works with MSVC2013 and SFML >= 2.3.