steinbergmedia / vst3sdk

VST 3 Plug-In SDK
Other
1.59k stars 162 forks source link

vstgui_assert error #53

Closed ergodaveh closed 3 years ago

ergodaveh commented 4 years ago

WHile attempt to use the sdkvst-sdk_3.6.14_build-24_2019-11-29 in a Qt5 project. The build incounters a vstgui_assert error

Qt5 5.14.1 MSVC 2017 CMake 3.16

externals\vst3sdk\vstgui4\vstgui\lib\malloc.h:46: error: C3861: 'vstgui_assert': identifier not found externals\vst3sdk\vstgui4\vstgui\lib\malloc.h:46: while compiling class template member function 'T &VSTGUI::Buffer<T,VSTGUI::MallocAllocator>::operator ' externals\vst3sdk\vstgui4\vstgui\lib\cbitmapfilter.cpp:554: see reference to function template instantiation 'T &VSTGUI::Buffer<T,VSTGUI::MallocAllocator>::operator ' being compiled externals\vst3sdk\vstgui4\vstgui\lib\cbitmapfilter.cpp:491: see reference to class template instantiation 'VSTGUI::Buffer<int32_t,VSTGUI::MallocAllocator>' being compiled

scheffle commented 3 years ago

Do you still have this problem with the latest release? We cannot reproduce here.

LeStahL commented 1 year ago

I have this issue on

-- Building for: Visual Studio 17 2022
-- The CXX compiler identification is MSVC 19.31.31104.0

with the sdk in commit 05c4a9763f311a58fe3f34b68a199e5eea92e2b4.

I investigated - it's a problem with the include order in cbitmapfilter.cpp.

Moving #include "malloc.h" above all other includes in the file fixes the compiler error.

I'm a bit unhappy with this solution tho, as it requires a modification in the source and you guys do not seem to accept PRs.

scheffle commented 1 year ago

Can you post the compiler output. Thank you.

LeStahL commented 1 year ago
\external\vst3sdk\vstgui4\vstgui\lib\malloc.h(46,33): error C3861: 'vstgui_assert': identifier not found [\build\external\vst3sdk\VSTGUI.build\vstgui\lib\vstgui.vcxproj]
\external\vst3sdk\vstgui4\vstgui\lib\malloc.h(46): message : while compiling class template member function 'T &VSTGUI::Buffer<T,VSTGUI::MallocAllocator>::operator [](size_t)' [\bu
ild\external\vst3sdk\VSTGUI.build\vstgui\lib\vstgui.vcxproj]
          with
  vstbus.cpp
          [
  vstcomponent.cpp
              T=int32_t
          ]
\external\vst3sdk\vstgui4\vstgui\lib\cbitmapfilter.cpp(557): message : see reference to function template instantiation 'T &VSTGUI::Buffer<T,VSTGUI::MallocAllocator>::operator [](size_t)' being
compiled [\build\external\vst3sdk\VSTGUI.build\vstgui\lib\vstgui.vcxproj]
          with
          [
              T=int32_t
          ]
\external\vst3sdk\vstgui4\vstgui\lib\cbitmapfilter.cpp(494): message : see reference to class template instantiation 'VSTGUI::Buffer<int32_t,VSTGUI::MallocAllocator>' being compiled [\build\external\vst3sdk\VSTGUI.build\vstgui\lib\vstgui.vcxproj]
LeStahL commented 1 year ago

Might be a symptom of templates containing the macro being expanded from the header (cbitmapfilter.h), where the macro is not defined yet (because it is included later, from the cpp file).

LeStahL commented 1 year ago

I use the sdk as git submodule - if I compile it directly (not as submodule), this error does not occur and everything works fine.

scheffle commented 1 year ago

Do you use precompiled headers or such a thing? Normally your error could not happen because vstgui_assert is defined in vstguidebug.h which is nearly always included.

LeStahL commented 1 year ago

No - but I created a minimal example for you (at https://github.com/LeStahL/vst3sdk-minimal-example.git):

git clone https://github.com/LeStahL/vst3sdk-minimal-example.git
cd vst3sdk-minimal-example
git submodule update --init --recursive
mkdir build
cd build
cmake ..
cmake --build . --config Release --  -m

This reproduces the problem reliably for me.

LeStahL commented 1 year ago

btw: the line set(CMAKE_INCLUDE_CURRENT_DIR ON) seems to cause it - if I don't have it, I can't reproduce it.

LeStahL commented 1 year ago

So, I will use the workaround

set(CMAKE_INCLUDE_CURRENT_DIR OFF)
add_subdirectory(external/vst3sdk)

which works fine. Thank you for your time & input on this.

scheffle commented 1 year ago

OK, according to the cmake documentation CMAKE_INCLUDE_CURRENT_DIR should be OFF and only be ON when files from the build directory are used for building which is not the case with the VST SDK. Still puzzled that this makes this compile error as this only adds two includes to the compiler. Anyway, glad you worked it out.