Hi.
I have the following error in my VSCode editor while trying to run a barebone JUCE application:
The JUCE folder is in the same directory as the folder of this project. I am running Linux. Where am I going wrong?
Hi.
I have the following error in my VSCode editor while trying to run a barebone JUCE application:
The JUCE folder is in the same directory as the folder of this project. I am running Linux. Where am I going wrong?
You need to update the include settings in vscode to include the base path to JUCE. CTRL+Shift+P → c++ edit configurations → include paths
You can specify for mac, windows and linux separately if needed.
These are the edits I made:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-linux/include",
"~/JUCE/"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}
But the error is persisting…
The JUCE headers are included from the modules
folder. So you should replace ~/JUCE/
by ~/JUCE/modules
Did that.
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-linux/include",
"~/JUCE/modules"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}
The same error is persisting.
Have you got the C++ extension pack installed?
Yes
I recommend using absolute or relative paths in your include paths.
“configurationProvider”: “ms-vscode.makefile-tools”
Might also be overriding your paths.
This is my change:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-linux/include",
"/home/onurJUCE/modules"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}
No difference
Doesn’t look right, are you missing a /
?
FWIW I don’t even have a c_cpp_properties.json
in my .vscode/
folder and don’t have any problems with includes… I did have issues with it when I first started using VSCode and the solution seemed to be to just remove the properties file and let VSCode figure it out itself.
I’m using the ms-vscode.cmake-tools
config provider if that’s of any use (on macOS I should add).
That’s likely due VSCode using the cmake-tools provider. I don’t use any providers with VS, and manually providing the header paths is required.
Yeah, I just have to make sure I add all my source files to a target_sources
list in a CMakeLists and the provider seems to do the rest of the work for me.
@oo92 can you share your CMakeLists where you add the sources and link the modules, etc?
Fixed it. Same issue.
Here is the Makefile
:
# Automatically generated makefile, created by the Projucer
# Don't edit this file! Your changes will be overwritten when you re-save the Projucer project!
# build with "V=1" for verbose builds
ifeq ($(V), 1)
V_AT =
else
V_AT = @
endif
# (this disables dependency generation if multiple architectures are set)
DEPFLAGS := $(if $(word 2, $(TARGET_ARCH)), , -MMD)
ifndef PKG_CONFIG
PKG_CONFIG=pkg-config
endif
ifndef STRIP
STRIP=strip
endif
ifndef AR
AR=ar
endif
ifndef CONFIG
CONFIG=Debug
endif
JUCE_ARCH_LABEL := $(shell uname -m)
ifeq ($(CONFIG),Debug)
JUCE_BINDIR := build
JUCE_LIBDIR := build
JUCE_OBJDIR := build/intermediate/Debug
JUCE_OUTDIR := build
ifeq ($(TARGET_ARCH),)
TARGET_ARCH :=
endif
JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DDEBUG=1" "-D_DEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=1" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70000" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" -I../../JuceLibraryCode $(CPPFLAGS)
JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0"
JUCE_TARGET_APP := OtoDecks
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -g -ggdb -O0 $(CFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) -fvisibility=hidden $(LDFLAGS)
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
endif
ifeq ($(CONFIG),Release)
JUCE_BINDIR := build
JUCE_LIBDIR := build
JUCE_OBJDIR := build/intermediate/Release
JUCE_OUTDIR := build
ifeq ($(TARGET_ARCH),)
TARGET_ARCH :=
endif
JUCE_CPPFLAGS := $(DEPFLAGS) "-DLINUX=1" "-DNDEBUG=1" "-DJUCE_DISPLAY_SPLASH_SCREEN=1" "-DJUCE_USE_DARK_SPLASH_SCREEN=1" "-DJUCE_PROJUCER_VERSION=0x70000" "-DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1" "-DJUCE_STANDALONE_APPLICATION=1" "-DJUCER_LINUX_MAKE_6D53C8B4=1" "-DJUCE_APP_VERSION=1.0.0" "-DJUCE_APP_VERSION_HEX=0x10000" -I../../JuceLibraryCode $(CPPFLAGS)
JUCE_CPPFLAGS_APP := "-DJucePlugin_Build_VST=0" "-DJucePlugin_Build_VST3=0" "-DJucePlugin_Build_AU=0" "-DJucePlugin_Build_AUv3=0" "-DJucePlugin_Build_AAX=0" "-DJucePlugin_Build_Standalone=0" "-DJucePlugin_Build_Unity=0" "-DJucePlugin_Build_LV2=0"
JUCE_TARGET_APP := OtoDecks
JUCE_CFLAGS += $(JUCE_CPPFLAGS) $(TARGET_ARCH) -O3 $(CFLAGS)
JUCE_CXXFLAGS += $(JUCE_CFLAGS) -std=c++14 $(CXXFLAGS)
JUCE_LDFLAGS += $(TARGET_ARCH) -L$(JUCE_BINDIR) -L$(JUCE_LIBDIR) -fvisibility=hidden $(LDFLAGS)
CLEANCMD = rm -rf $(JUCE_OUTDIR)/$(TARGET) $(JUCE_OBJDIR)
endif
OBJECTS_APP := \
$(JUCE_OBJDIR)/Main_90ebc5c2.o \
$(JUCE_OBJDIR)/MainComponent_a6ffb4a5.o \
.PHONY: clean all strip
all : $(JUCE_OUTDIR)/$(JUCE_TARGET_APP)
$(JUCE_OUTDIR)/$(JUCE_TARGET_APP) : $(OBJECTS_APP) $(RESOURCES)
@echo Linking "OtoDecks - App"
-$(V_AT)mkdir -p $(JUCE_BINDIR)
-$(V_AT)mkdir -p $(JUCE_LIBDIR)
-$(V_AT)mkdir -p $(JUCE_OUTDIR)
$(V_AT)$(CXX) -o $(JUCE_OUTDIR)/$(JUCE_TARGET_APP) $(OBJECTS_APP) $(JUCE_LDFLAGS) $(JUCE_LDFLAGS_APP) $(RESOURCES) $(TARGET_ARCH)
$(JUCE_OBJDIR)/Main_90ebc5c2.o: ../../Source/Main.cpp
-$(V_AT)mkdir -p $(JUCE_OBJDIR)
@echo "Compiling Main.cpp"
$(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<"
$(JUCE_OBJDIR)/MainComponent_a6ffb4a5.o: ../../Source/MainComponent.cpp
-$(V_AT)mkdir -p $(JUCE_OBJDIR)
@echo "Compiling MainComponent.cpp"
$(V_AT)$(CXX) $(JUCE_CXXFLAGS) $(JUCE_CPPFLAGS_APP) $(JUCE_CFLAGS_APP) -o "$@" -c "$<"
clean:
@echo Cleaning OtoDecks
$(V_AT)$(CLEANCMD)
strip:
@echo Stripping OtoDecks
-$(V_AT)$(STRIP) --strip-unneeded $(JUCE_OUTDIR)/$(TARGET)
-include $(OBJECTS_APP:%.o=%.d)