Open gvanem opened 3 years ago
Visual Studio tends to be more permissive in regards to C++. Also later versions of the C++ standard can add, redefine, deprecate, and even remove items. That is one reason there are flags to set the c++ standard version. The plugin example and nana library used Visual Studio 2017. I also used it for my plugin to eliminate potential problems.
The problem with BuildAnnotatorItem is the class name was left in the member function declaration. Remove the SDRunoPlugin_Fran:: part.
The problem with pick_source is due to the parameter to the function not being const. The definition needs to be changed to: void SDRunoPlugin_FranForm::pick_source(const std::string & source)
In addition you also need to make the parameter in the called SetSource function at each level const as well. void SetSource(const std::string & source);
I have corrected these problems. The changes will be committed and pushed when I complete a few added features.
Okay, but yikes! Coming from plain C-99, what a mess it is with C++!
Here are my diffs that works with both MSVC-2019 and clang-cl
in -std:c++17
mode:
--- a/SDRunoPlugin_Fran.cpp 2021-02-21 10:41:42
+++ b/SDRunoPlugin_Fran.cpp 2021-02-23 10:10:26
@@ -307,7 +307,7 @@
return sourceList;
}
-void SDRunoPlugin_Fran::SetSource(std::string & s)
+void SDRunoPlugin_Fran::SetSource(const std::string & s)
{
if (!s.compare("ALL"))
source.clear();
--- a/SDRunoPlugin_Fran.h 2021-02-21 10:41:42
+++ b/SDRunoPlugin_Fran.h 2021-02-23 10:10:18
@@ -77,7 +77,7 @@
void CalculateLimits();
void DeleteStations();
void DeleteSources();
- void SetSource(std::string & s);
+ void SetSource(const std::string & s);
std::vector<std::string> & GetSources();
--- a/SDRunoPlugin_FranForm.cpp 2021-02-21 10:41:42
+++ b/SDRunoPlugin_FranForm.cpp 2021-02-23 10:07:41
@@ -337,7 +337,7 @@
if(!m_files.empty())
m_parent.ProcessFiles(m_files);
}
-void SDRunoPlugin_FranForm::pick_source(std::string & source)
+void SDRunoPlugin_FranForm::pick_source(const std::string & source)
{
m_parent.SetSource(source);
}
--- a/SDRunoPlugin_FranForm.h 2021-02-21 10:41:42
+++ b/SDRunoPlugin_FranForm.h 2021-02-23 10:07:21
@@ -91,7 +91,7 @@
IUnoPluginController & m_controller;
void pick_file(bool is_open);
- void pick_source(std::string & source);
+ void pick_source(const std::string & source);
std::vector< nana::filebox::path_type > m_files;
};
--- a/SDRunoPlugin_FranUi.cpp 2021-02-21 10:41:42
+++ b/SDRunoPlugin_FranUi.cpp 2021-02-23 10:09:23
@@ -187,7 +187,7 @@
m_parent.CalculateLimits();
}
-void SDRunoPlugin_FranUi::SetSource(std::string & source)
+void SDRunoPlugin_FranUi::SetSource(const std::string & source)
{
m_parent.SetSource(source);
}
--- a/SDRunoPlugin_FranUi.h 2021-02-21 10:41:42
+++ b/SDRunoPlugin_FranUi.h 2021-02-23 10:09:11
@@ -43,7 +43,7 @@
int LoadX();
int LoadY();
void ProcessFiles(std::vector <nana::filebox::path_type>& files);
- void SetSource(std::string & source);
+ void SetSource(const std::string & source);
private:
void SaveLocation();
But clang-cl
still shows this warning:
In file included from SDRunoPlugin_Fran.cpp:9:
./SDRunoPlugin_Fran.h(73,7): warning: 'AnnotatorProcess' overrides a member function but is not marked 'override'
[-Winconsistent-missing-override]
void AnnotatorProcess (std::vector<IUnoAnnotatorItem>& items);
^
../../SDR-Uno-plugin-API/include\iunoannotator.h(30,15): note: overridden virtual function is here
virtual void AnnotatorProcess(std::vector<IUnoAnnotatorItem>& items) = 0;
^
BTW. these files are still in Widechar (UTF-16LE) mode that clang-cl doesn't handle:
dllmain.cpp
SDRunoPlugin_FranProject.cpp
SDRunoPlugin_Fran.rc
why can not these be plain ASCII?
I have no problem build this plugin with MSVC-2019 and
-std:c++17
. But usingcl -std:latest
(some C++20xx standard AFAIK), orclang-cl -std:c++latest
there are some issues.First
cl -std:latest
, when compilingSDRunoPlugin_Fran.cpp
:clang-cl
compilesSDRunoPlugin_Fran.cpp
just fine. But aclang-cl -std:latest SDRunoPlugin_FranForm..cpp
gives this error (besides a ton of warnings):Since my C++ knowledge is limited I fail to understand and fix these issues.