Compiling errors on porting to V1

Hello,

I m migrating to V1.0 and encounter some compiling problems.
I m on step 1.8. and try to compile a module that doesn’t use on* event or custom widgets using the SDK V1.0 on windows .

These erros are about widget struct declarations :

E.G:

  1. error: ‘background’ was not declared in this scope

when declaring my widget struct like this

struct HexaJackPort : SVGPort {
	HexaJackPort() {
		background->svg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/HexaJackPort.svg"));
		background->wrap();
		box.size = background->box.size;
	}
};
  1. error : error: expected class-name before ‘{’

when declaring switch like this:

struct TR808BigButton : SVGSwitch, MomentarySwitch {
	TR808BigButton() {
		addFrame(APP->window->loadSvg (asset::plugin(pluginInstance,"res/TRBigButton.svg")));
		sw->wrap();
		box.size = sw->box.size;
	}
};

I’m using the rack0.hpp header and my make file looks like this

RACK_DIR ?= ../..
SOURCES = $(wildcard src/*.cpp) $(wildcard src/*.c)

DISTRIBUTABLES += $(wildcard LICENSE*) res

include $(RACK_DIR)/plugin.mk
include $(RACK_DIR)/arch.mk

Thanks

UP: Solved by using “momentary = true;”

and

setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, “res/HexaJackPort.svg”)));

for the jack,

I m going on the next step :slight_smile:

Just started typing an answer, but my suggestions matched what you figured out!

Thanks :slight_smile:

I am not a wiz with msys or cmake, so I apologize if this is basic. I am working on a fresh install of Rack with checkout v1. What does this mean, if you have a minute? Thanks very much!

`$ make -j8 dep
make -C dep
make[1]: Entering directory ‘/home/djpeter1/Rack.190519/dep’
mkdir -p .
cd rtaudio && mkdir -p build
cd rtaudio/build && cmake -G ‘MSYS Makefiles’ -DCMAKE_INSTALL_PREFIX="/home/djpeter1/Rack.190519/dep/." -DCMAKE_INSTALL_LIBDIR=lib -DRTAUDIO_BUILD_STATIC_LIBS=ON -DRTAUDIO_API_DS=ON -DRTAUDIO_API_WASAPI=ON -DRTAUDIO_API_ASIO=ON …
CMake Error at CMakeLists.txt:2 (cmake_minimum_required):
CMake 3.10 or higher is required. You are running version 3.9.2

– Configuring incomplete, errors occurred!
make[1]: *** [Makefile:159: lib/librtaudio.a] Error 1
make[1]: Leaving directory ‘/home/djpeter1/Rack.190519/dep’
make: *** [Makefile:51: dep] Error 2

djpeter1@LASLW17040494 MINGW64 ~/Rack.190519
$ pacman -S cmake
warning: cmake-3.6.2-1 is up to date
`

Generally when posting build issues, post on GitHub, give your OS and version, and surround code with ``` on its own line.

In your case, I can make an educational guess though. Your MSYS2 packages are out of date, so run pacman -Syu.

1 Like

Thanks very much, Andew! I will work on it!

having the same issue. where did you put this “momentary = true” line?

In your custom widget’s constructor. See https://github.com/VCVRack/Rack/blob/2c147c285e2200e4e27e048c9f4e28663dbc86da/include/componentlibrary.hpp#L546-L552 for examples.

thx I was looking at that fle and discovered i need to change MomentarySwitch to SvgSwitch