Hey, I am trying to do the basic MainWindow tutorial which is apparently on the website. and following the instructions, I have the following error code.
1>------ Build started: Project: MainWindowTutorial_App, Configuration: Debug x64 ------
1>Main.cpp
1>C:\Users\Bishoy\Desktop\MainWindowTutorial\Source\Main.cpp(18,37): warning C4996: 'juce::ScopedPointer<MainWindowTutorialApplication::MainWindow>::~ScopedPointer': was declared deprecated
1>C:\JUCE\modules\juce_core\memory\juce_ScopedPointer.h(56): message : see declaration of 'juce::ScopedPointer<MainWindowTutorialApplication::MainWindow>::~ScopedPointer'
1>C:\Users\Bishoy\Desktop\MainWindowTutorial\Source\Main.cpp(25,36): warning C4100: 'commandLine': unreferenced formal parameter
1>C:\Users\Bishoy\Desktop\MainWindowTutorial\Source\Main.cpp(47,48): warning C4100: 'commandLine': unreferenced formal parameter
1>MainWindowTutorial_App.vcxproj -> C:\Users\Bishoy\Desktop\MainWindowTutorial\Builds\VisualStudio2019\x64\Debug\App\MainWindowTutorial.exe
1>Done building project "MainWindowTutorial_App.vcxproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Replacing the ScopedPointer
with std::unique_ptr
can solve the problem but can someone explain why is that? and why if that’s the solution, it’s not updated in the tutorial page. Also I am getting unreferenced formal parameter
in the commandLine
.
Code:
/*
==============================================================================
This file was auto-generated!
It contains the basic startup code for a JUCE application.
==============================================================================
*/
#include "../JuceLibraryCode/JuceHeader.h"
//==============================================================================
class MainWindowTutorialApplication : public JUCEApplication
{
public:
//==============================================================================
MainWindowTutorialApplication() {}
const String getApplicationName() override { return ProjectInfo::projectName; }
const String getApplicationVersion() override { return ProjectInfo::versionString; }
bool moreThanOneInstanceAllowed() override { return true; }
//==============================================================================
void initialise (const String& commandLine) override
{
// Add your application's initialisation code here..
mainWindow = new MainWindow(getApplicationName());
}
void shutdown() override
{
// Add your application's shutdown code here..
mainWindow = nullptr;
}
//==============================================================================
void systemRequestedQuit() override
{
// This is called when the app is being asked to quit: you can ignore this
// request and let the app carry on running, or call quit() to allow the app to close.
quit();
}
void anotherInstanceStarted (const String& commandLine) override
{
// When another instance of the app is launched while this one is running,
// this method is invoked, and the commandLine parameter tells you what
// the other instance's command-line arguments were.
}
class MainWindow : public DocumentWindow
{
public:
MainWindow(String name) : DocumentWindow(name,
Colours::lightgrey,
DocumentWindow::allButtons)
{
centreWithSize(300, 200);
setVisible(true);
}
void closeButtonPressed() override
{
JUCEApplication::getInstance()->systemRequestedQuit();
}
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainWindow)
};
private:
ScopedPointer<MainWindow> mainWindow;
};
//==============================================================================
// This macro generates the main() routine that launches the app.
START_JUCE_APPLICATION (MainWindowTutorialApplication)