0
0

I recently downloaded FMOD, and finished reading through the documentation.

I’m stuck at creating the system object. I get this error:
1>music.obj : error LNK2019: unresolved external symbol FMOD_System_Create referenced in function "enum FMOD_RESULT __cdecl FMOD::System_Create(class FMOD::System * *)" (?System_Create@FMOD@@YA?AW4FMOD_RESULT@@PAPAVSystem@1@@Z)

Basically this is what my code looks like:


include <fmod.hpp>

void initializeMusic() {
// Initializes FMOD so that music can be played.

// Local variables:
const   unsigned int     numberOfVirtualVoices      = 100;
        FMOD_RESULT      result;
        FMOD::System    *system;

// Creates the main system object.
result = FMOD::System_Create(&amp;system);

}

If I get rid of the last line of code, everything compiles and runs. It’s just when I add that last line I get that error. It looks like I’m forgetting to add something but the document just says I need to to include fmod.hpp (because I’m coding in C++ using Visual C++ 2008.

Any ideas? (I got the latest stable download installed & added the paths for the include files).

  • You must to post comments
0
0

:)

No problem, I’m at a loss so whatever.

Yes, I linked the library (& include) files via the above method.

I just tried copying fmodex.dll into my project folder but the same error occurred.

I’m curious has anyone copied my code into their complier & tried it? Maybe I misspelled something?

  • You must to post comments
0
0

Uh…. odd, it’s working now.

I made some changes to my project (renamed a function that FMOD didn’t have access to, created another function that FMOD would have access (quitting the program if result != FMOD_OK), & I added a function to check for errors in FMOD’s result).

I tried backtracking to see what caused it to work but it seems to just compile now.

Strange.

  • You must to post comments
0
0

Did you also add a *.lib file in visual studio? It depends on your compiler which library file you have to use. See docs which one you have to use. The *.lib files are somewhere in your FMOD dir.

  • You must to post comments
0
0

Nevermind, I just took a look at some of the other threads and someone is already asking the same question that I was.

  • You must to post comments
0
0

Ops, heh I forgot to write that down. Yes I did, my code looks like:


// Header files:

include <fmod.hpp>

// Library files:

pragma comment (lib, "fmodex_vc.lib")

void initializeMusic() {
// Initializes FMOD so that music can be played.

// Local variables:
const   unsigned int     numberOfVirtualVoices      = 100;
        FMOD_RESULT      result;
        FMOD::System    *system;

// Creates the main system object.
result = FMOD::System_Create(&amp;system);

}

I added directories for both header files & library files. I tried all the library files (obviously the one above is the only one that works as I’m using visual studio) but i still get the error.

  • You must to post comments
0
0

[quote="Gamer Pro":1gxdn36y]

// Library files:

pragma comment (lib, "fmodex_vc.lib")

I added directories for both header files & library files. I tried all the library files (obviously the one above is the only one that works as I’m using visual studio) but i still get the error.[/quote:1gxdn36y]

That "#Pragma comment" really aint doing it.
[i:1gxdn36y]The #pragma comment directive places a comment string into the target or object file.[/i:1gxdn36y]

Quickly i would say that error itself is pretty plain: It does not know/find what library it will link against.

I dont remember how to exactly do it in VS, but you need to import the correct library to project (it will be visible in the source browser or so) (project / add, or file / import, maybe project settings / linker / additional depencies or some command switch), maybe someone else remembers?. but keep on digging.. (I just did it couple weeks ago, but cant remember correct way because i’m working currently with other tools than VS)

  • You must to post comments
0
0

If your problem is what I think it is, then do the following (using VC++08, should be the same for 05 or 03):
Click Project at the top, and choose the last option, <Your project name> Properties…
On the tree view on the left, go into Configuration Properties->Linker->Input. Now look on the right. The top option should be "Additional Dependencies". Add the line "fmodex_vc.lib" to that field.

  • You must to post comments
0
0

Well, actually pragma comment(lib… should work. It’s how I use most of the libraries in my code, too.

The ".lib" extension isn’t needed, but as far as I know it shouldn’t cause problems. Nevertheless try removing the extension. If it continues to make problems, try adding the library in the old-fashioned way as previously mentioned… There might be an option that disables the use of "pragma comment(lib…" and it’s set on your project.
Some people consider it evil and unsafe :)

<edit>
Hm… VC2008 you say… that might actually be the problem. C++ doesn’t have a standartized code generation (as does C) and since you’re using the C++ library which isn’t compiled with vc 2008, that might be the problem itself.
If you’ve bought a commercial license (and thus have the source code) of FMOD try compiling it by yourself with your compiler and then using the library.

That’s just an idea, though
</edit>

  • You must to post comments
0
0

Nope nothing works 😕

I get the same error when I add the library in the ‘old fashion way’ (ie: adding it via addition dependencies ). When adding the library I tried it will just ‘fmodex_vc.lib’ & with the directory (C:/Program Files/SDKs…./fmodex_vc.lib). I tried both of those along with & without the #pragma and still nothing.

It SHOULDN’T be the #pragma (through it could be) as I’m using the directX library files this way:

pragma comment (lib, "d3d9.lib")

pragma comment (lib, "d3dx9.lib")

pragma comment (lib, "dinput.lib")

pragma comment (lib, "dinput8.lib")

pragma comment (lib, "dxguid.lib")

Still I tried it without the ‘.lib’ and it works exactly as it did with the extention. Seeing how up to before FMOD it compiled & ran I don’t think I’ve got some option enabled that disables #pragma either (because of directX).

I downloaded the ‘hobbyist’ licence as that’s what I am, a kid (loosely defined) learning these things.

When I change the code to this (ie: using C, not C++ but still on Visual C++ 2008 Express Edition)

// Header files:

include <fmod.h>

// Library files:

pragma comment (lib, "fmodex_vc.lib")

void initializeMusic() {
// Initializes FMOD so that music can be played.

// Local variables:
const   unsigned int     numberOfVirtualVoices      = 100;
        FMOD_RESULT      result;
        FMOD_SYSTEM      *system;

// Creates the main system object.
result = FMOD_System_Create(&amp;system);

}

I still get the error. So I’m thinking it’s not necessary that ‘C++ doesn’t have a standartized code generation (as does C) ‘ as it may be more of a Visual C++ 2008 Express Edition ‘quirk’.

  • You must to post comments
0
0

Have you added the FMOD api/lib folder to your project’s list of library folders?

  • You must to post comments
0
0

‘I added directories for both header files & library files.’

Yes, :).

I was looking through Google again & I came across this:
http://www.allegro.cc/forums/thread/591230

Any idea what this WIN32 thing is? (I know, simple, stupid question, but what the hay).

  • You must to post comments
0
0

Sorry to be asking the same questions again, but just to clarify, you did this?:
On the toolbar: Tools->Options…
On the treeview: Projects and Solutions->VC++ Directories
In the right-hand dropdown box: Library files
Click the folder icon (new line)
Browse to (FMOD install)\api\lib
With the folder highlighted, click "Select Folder".
If you’ve done all that… maybe it’s something with the fmodex.dll? Have you tried copying that into your project’s folder?

metal

  • You must to post comments
Showing 12 results
Your Answer

Please first to submit.