[SOLVED]Can`t link FMOD in Windows.



  • Hello. I am using FMOD in my project. It`s working on linux, but when I try to compile Win32 it gives me that:
    @
    :-1: error: error: /FMOD/Win32/libs/ -lfmodex: No such file or directory
    @
    Here is my pro. file:
    @
    #-------------------------------------------------#

    Project created by QtCreator 2014-11-04T22:15:51#

    #-------------------------------------------------#

    QT += core gui multimedia

    linux {
    message("*using settings for linux")
    #FMOD linux
    INCLUDEPATH += /home/ilian/fmodstudioapi10509linux/api/lowlevel/inc/
    LIBS += -L/home/ilian/fmodstudioapi10509linux/api/lowlevel/lib/x86/ -lfmod
    }

    win32 {
    message("*using settings for windows")
    #FMOD windows
    INCLUDEPATH += "$$_PRO_FILE_PWD/FMOD/Win32/inc/"
    LIBS += "$$_PRO_FILE_PWD/FMOD/Win32/libs/ -lfmodex"
    }

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = MathForFun
    TEMPLATE = app
    RESOURCES += application.qrc

    SOURCES +=
    MainWindow.cpp
    ActionRectItem.cpp
    ActionEllipseItem.cpp
    TextNodes.cpp
    GameOfNumbers.cpp
    AssetManager.cpp
    WindowFrame.cpp
    Callbacks.cpp
    FModePlayer.cpp

    HEADERS +=
    MainWindow.h
    ActionRectItem.h
    ActionEllipseItem.h
    TextNodes.h
    GameOfNumbers.h
    AssetManager.h
    GameObserver.h
    WindowFrame.h
    LayoutFactory.h
    Callbacks.h
    FModePlayer.h

    FORMS +=

    @
    IMPORTANT. I am using qtcreator MingGW build under Fedora with Wine. So if there is a workaround please help.
    [EDIT] Ive read about linking the libfmod.a if using mingw but I dont understand how to do it in the pro file or do I have to use the pragma?
    [SOLVED] I was able to solve that problem now each time I click the circles the sound is played:
    https://www.flickr.com/photos/heatblazer/15877532839/



  • I have to bump this with the similar android question:
    How to link it for android? I am using Qt creator for Fedora ( native not emulated ) and my FMOD dir is in tht QT project I wish to deploy to on my android device.


  • Moderators

    @
    LIBS += "$$_PRO_FILE_PWD/FMOD/Win32/libs/ -lfmodex"
    @

    You're linking to fmod on linux but to fmodex on windows. This should be -lfmod for windows too.

    I don't know about android.



  • OK. Here is what Ive changed: @ win32 { message("*using settings for windows") #FMOD INCLUDEPATH += /home/ilian/QT5/MathForFun/FMOD/Win32/api/lowlevel/inc/ LIBS += -L/home/ilian/QT5/MathForFun/FMOD/Win32/api/lowlevel/lib/ -lfmod } @ Now I get completely missing all of the functions I called with FMOD: @ Z:\home\ilian\QT5\MathForFun\FModePlayer.cpp:-1: error: undefined reference toFMOD::System::createSound(char const*, unsigned int, FMOD_CREATESOUNDEXINFO*, FMOD::Sound**)@20'
    @

    So like I can`t get why is that :(


  • Moderators

    I know little about wine, but shouldn't you include the drive letter in the paths?
    And have you re-run qmake after the changes?



  • I`ve tried with
    @
    LIBS += Z:/home/ilian/QT5/MathForFun/FMOD/Win32/api/lowlevel/lib/
    @
    and got this
    @
    :-1: error: cannot find Z:/home/ilian/QT5/MathForFun/FMOD/Win32/api/lowlevel/lib/: Permission denied
    @
    Weird stuff... I should try building it on real Windows with VSC :(


  • Moderators

    Sounds reasonable. Maybe try to chmod the permissions for that directory.



  • I did. Nothing happened. Ive also tried to point to this folder: @ Z:/home/ilian/.wine/drive_c/Program Files/FMOD SoundSystem/FMOD Studio API Windows/api/lowlevel/lib/ @ Apparently where Ive installed the fmod, but it tells me that
    @
    :-1: error: error: /home/ilian/.wine/drive_c/Program\Files/FMOD: No such file or directory
    @
    Really no idea....


  • Moderators

    You've got a space in the folder name "FMOD SoundSystem". Tools hate that.



  • So what should I do? Rename my dirs?
    [quote author="Chris Kawa" date="1419069554"]You've got a space in the folder name "FMOD SoundSystem". Tools hate that.[/quote]


  • Moderators

    Either that or copy the relevant files to some path without spaces e.g. your app directory or something.



  • Here: http://www.qtcentre.org/threads/2831-Qt-and-fmod is a guy who says its working. However I dont have libfmodex.a to my download for Windows. I have libfmod.a and libfmodL.a. I changed to this:
    @
    INCLUDEPATH += Z:/home/ilian/.wine/drive_c/FMODSoundSystem/FMODStudioAPIWindows/api/lowlevel/inc/
    LIBS += Z:/home/ilian/.wine/drive_c/FMODSoundSystem/FMODStudioAPIWindows/api/lowlevel/lib/libfmod.a
    @
    But I still get the undefined references to all fmod functions I`ve called.



  • Thank you, mr.Chris Kawa. I was able to make it work in Wine + MinGW. Apparenlty Ive read there were C++ ABI problems, so Ive changed my function to the pure C API they support like that:
    @
    bool FMPlayer::systemInit(const char *fname, int len) {

    FMOD_CREATESOUNDEXINFO *info = new FMOD_CREATESOUNDEXINFO();
    info->cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
    info->length = len;
    FMOD_CHANNEL *channel;
    //FMOD::Channel* channel;
    //FMOD::System* system;
    //FMOD::Sound* sound;
    //FMOD::System_Create(&system);
    FMOD_SYSTEM *system;
    FMOD_SOUND *sound;
    FMOD_System_Create(&system);
    FMOD_System_Init(system, 32, FMOD_INIT_NORMAL, 0);
    
    //system->init(32, FMOD_INIT_NORMAL, 0);
    if ( FMOD_OK == ( FMOD_System_CreateSound(system,
                          fname,FMOD_OPENMEMORY, info, &sound)) ) {
    

    // if ( FMOD_OK == system->createSound(fname,
    // FMOD_OPENMEMORY, info, &sound) ) {

        FMOD_Sound_SetMode(sound, FMOD_LOOP_OFF);
    

    // sound->setMode(FMOD_LOOP_OFF);
    // system->playSound(sound, false, 0, &channel);
    FMOD_System_PlaySound(system, sound, false, 0, &channel);
    return true;
    } else {
    return false;
    }
    }
    @
    Ive left the commented code to see what Ive changed. Now it plays the desired sound... Whew. That was nasty. I got worried I wont be able to fix it. Thanks for the help. Ill avoid and whitespaces from now on. Regards from a newbie coder like me :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.