Menu

Building for MSVC

2023-12-14
2023-12-15
  • Gisle Vanem

    Gisle Vanem - 2023-12-14

    I'm struggling to compile this project with the qmake generated Nmake-files.
    E.g. this error seems related to a missing USE_SOAPY:

    src\sound\soundinterfacefactory.cpp(89): error C2259: 'CSoundInMMSystem': 
    cannot instantiate abstract class
    windows/Sound.h(54): note: see declaration of 'CSoundInMMSystem'
    src\sound\soundinterfacefactory.cpp(89): note: due to following members:
    src\sound\soundinterfacefactory.cpp(89): 
    note: 'bool CSoundInInterface::Read(CVector<short> &,CParameter &)': is abstract
    sound\soundinterface.h(44): note: see declaration of 'CSoundInInterface::Read'
    src\sound\soundinterfacefactory.cpp(89): error C2259: 
    'CSoundInMMSystem': cannot instantiate abstract class
    windows/Sound.h(54): note: see declaration of 'CSoundInMMSystem'
    src\sound\soundinterfacefactory.cpp(89): note: due to following members:
    src\sound\soundinterfacefactory.cpp(89): 
    note: 'bool CSoundInInterface::Read(CVector<short> &,CParameter &)': is abstract
    

    Then trying to build with CONFIG += soapysdr, fails to compile the same file:

    src\sound\soundinterfacefactory.cpp(86): error C2061: 
    syntax error: identifier 'CSoapySDRIn'
    

    since this is not in the WIN32 part:

    #ifdef USE_SOAPYSDR
    #include "drm_soapySDR.h"
    #endif
    

    So what CONFIG-settings are allowed on Windows?

    And most importantly, what does this cannot instantiate abstract class really mean?
    I'm not so fluent in C++.

     
  • Oliver Haffenden

    Hello Gisle and thanks for your enquiry. I haven't tried building my branch (dream-ollie or dream-ollie-deployed) on Windows so I'm not surprised there are issues. I'll try to help you later this afternoon, but to point me in the right direction: are you wanting to use Dream with an SDR front-end of some kind, using the SoapySDR library? That's the main thing that my branches offer in addition to e.g. dream-rafa.

     
    • Oliver Haffenden

      I've just looked and I see what you mean about the #include being omitted if WIN32 is defined. If you do want to use Soapy, I think the first step would be to move that outside that #if altogether. Have you been able to install Soapy itself? It looks like there are Windows installers for it.

       
  • Gisle Vanem

    Gisle Vanem - 2023-12-15

    Have you been able to install Soapy itself?

    Sure.

    And there areIMHO too many #ifdef tests in this ollie branch;
    * A test for HAVE_LIBZis superflous. zlib is required.
    * Seems to me SoapySDR is required too.

     
  • Oliver Haffenden

    The source is designed to be able to build with a wide range of different configurations: e.g. it can use different audio decoding libraries, different sound devices etc. Trying to make these all work at the same time is like whacking moles, but feedback from people like yourself who have a different configuration is a great help to us, so thanks for taking the time to post.

    If it won't build without Soapy, that's my bad, because it should be possible to build it to use a soundcard input carrying a low IF or I/Q signal, just like it always did.

    The immediate problem with Windows, when you don't haveUSE_SOAPY defined, is that the function signature for Read() doesn't match the abstract base-class method: it's currently:

    virtual bool Read(CVector<short>& psData);
    

    But should be

    virtual bool Read(CVector<short>& psData, CParameter &param);
    

    and the same in the cpp file, i.e. line 108 should be:

    bool CSoundInMMSystem::Read(CVector<short>& psData, CParameter &param)
    

    The param argument isn't used, but it needs to be there for the compiler to recognise that Read() is intended to implement the base-class Read() function. Without it, the compiler will treat it as a separate function, leaving the base-class function un-implemented, making it impossible to instantiate CSoundInMMSystem.

    If the above explanation doesn't make sense, you'll find lots of explanations of pure virtual functions, abstract base classes etc. on the web, for example here.

    Let

     
  • Gisle Vanem

    Gisle Vanem - 2023-12-15

    Ok, I've fixed that.
    It now compiles, but running DreamConsole --test 1, it aborts on a sample-rate of 96000.

    In SoapyRTLSdr/settings.cpp:

     throw std::runtime_error("setSampleRate failed: RTL-SDR does not support this sample rate");
    

    And Dream.exe crashes at start-up:

     class CUpstreamDI : public CReceiverModul<_BINARY, _BINARY> , public CPacketSink
    {
    public:
        CUpstreamDI();
        virtual ~CUpstreamDI();
    
        /* CRSIMDIInInterface */
        bool SetOrigin(const std::string& strAddr);
        bool GetInEnabled() {return source != nullptr;}  // << here
    

    since this == nullptr !? How can this happen?

     
  • Gisle Vanem

    Gisle Vanem - 2023-12-15

    But there are other issues. Partly due to a recent Hamlib commit. Attached are my diffs.

    Missing using namespace std;, std::high_resolution::to_time_t() etc. etc.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.