Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

LNK2019 error on compilation, simple mp3 playback

$
0
0
Hi,
Recently I have been trying to include some audio into my program, I have read about the FMOD API, however all the examples I have found are for the FMOD3, which is no longer available and I don't think the Ex version is suitable since I want to keep it as simple as possible. I have found this: http://code4k.blogspot.co.uk/2010/05/playing-mp3-in-c-using-plain-windows.html which I cannot compile, and here is my code:


// Including the header file at the start of the main..
#include "Audio.h"
// Here are my variable declarations

int main(int argc, char ** argv)
 {
// Setting up display window, and the rest of the functions
  
MP3Player player;
 player.OpenFromFile("main.mp3");
 player.Play();

// Game loop where all drawing functions & inputs are dealt with
 while (G_GameRunning)
    {
	double playerPositionInSeconds = player.GetPosition();

       if (G_Input->WindowClosed())
       {

          G_GameRunning = false;
       }
    }

	player.Close();
        return 0;
}



The above code returns this:

1>------ Build started: Project: SDL_Start, Configuration: Debug Win32 ------
1>  Main.cpp
1>..\audio.h(206): warning C4244: '=' : conversion from 'double' to 'DWORD', possible loss of data
1>  Audio.cpp
1>..\audio.h(206): warning C4244: '=' : conversion from 'double' to 'DWORD', possible loss of data
1>  Generating Code...
1>Main.obj : error LNK2019: unresolved external symbol __imp__CreateStreamOnHGlobal@12 referenced in function "public: long __thiscall MP3Player::OpenFromMemory(unsigned char *,unsigned long)" (?OpenFromMemory@MP3Player@@QAEJPAEK@Z)
1>Main.obj : error LNK2019: unresolved external symbol __imp__CoInitialize@4 referenced in function "public: long __thiscall MP3Player::OpenFromMemory(unsigned char *,unsigned long)" (?OpenFromMemory@MP3Player@@QAEJPAEK@Z)
1>..\Debug\SDL_Start.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I am new to C++ in general, however I would like to get this done, any help would be appreciated.
Thanks

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>