diff mbox series

[2/5] KernelShark: Fix compilation issues on Fedora 32

Message ID 20200727071823.169962-3-tz.stoyanov@gmail.com (mailing list archive)
State New
Headers show
Series Add support for opening trace.dat files with multuiple buffers | expand

Commit Message

Tzvetomir Stoyanov (VMware) July 27, 2020, 7:18 a.m. UTC
From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>

Included <string.h> to fix this compilation error:
   "error: ‘string’ in namespace ‘std’ does not name a type"
Converted fontHeight and stringWidth to inline to fix these
compilation errors:
   "multiple definition of `fontHeight';"
   "multiple definition of `stringWidth';"

Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
---
 src/KsPlotTools.cpp | 1 +
 src/KsPlotTools.hpp | 1 +
 src/KsUtils.hpp     | 4 ++--
 3 files changed, 4 insertions(+), 2 deletions(-)

Comments

Steven Rostedt July 28, 2020, 1:23 p.m. UTC | #1
On Mon, 27 Jul 2020 10:18:20 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> From: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
> 
> Included <string.h> to fix this compilation error:

s/<string.h>/<string>

>    "error: ‘string’ in namespace ‘std’ does not name a type"
> Converted fontHeight and stringWidth to inline to fix these
> compilation errors:
>    "multiple definition of `fontHeight';"
>    "multiple definition of `stringWidth';"
> 

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> Signed-off-by: Tzvetomir (VMware)  Stoyanov <tz.stoyanov@gmail.com>
> ---
>  src/KsPlotTools.cpp | 1 +
>  src/KsPlotTools.hpp | 1 +
>  src/KsUtils.hpp     | 4 ++--
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/KsPlotTools.cpp b/src/KsPlotTools.cpp
> index 17db451..7dcd4f2 100644
> --- a/src/KsPlotTools.cpp
> +++ b/src/KsPlotTools.cpp
> @@ -12,6 +12,7 @@
>  // C
>  #include <math.h>
>  #include <cstring>
> +#include <string>
>  
>  // C++
>  #include <algorithm>
> diff --git a/src/KsPlotTools.hpp b/src/KsPlotTools.hpp
> index 75fb4da..c66fea3 100644
> --- a/src/KsPlotTools.hpp
> +++ b/src/KsPlotTools.hpp
> @@ -14,6 +14,7 @@
>  
>  // C
>  #include <math.h>
> +#include <string>
>  
>  // C++
>  #include <limits>
> diff --git a/src/KsUtils.hpp b/src/KsUtils.hpp
> index cfb45f4..5857099 100644
> --- a/src/KsUtils.hpp
> +++ b/src/KsUtils.hpp
> @@ -36,7 +36,7 @@
>  
>  //! @cond Doxygen_Suppress
>  
> -auto fontHeight = []()
> +inline auto fontHeight = []()
>  {
>  	QFont font;
>  	QFontMetrics fm(font);
> @@ -44,7 +44,7 @@ auto fontHeight = []()
>  	return fm.height();
>  };
>  
> -auto stringWidth = [](QString s)
> +inline auto stringWidth = [](QString s)
>  {
>  	QFont font;
>  	QFontMetrics fm(font);
diff mbox series

Patch

diff --git a/src/KsPlotTools.cpp b/src/KsPlotTools.cpp
index 17db451..7dcd4f2 100644
--- a/src/KsPlotTools.cpp
+++ b/src/KsPlotTools.cpp
@@ -12,6 +12,7 @@ 
 // C
 #include <math.h>
 #include <cstring>
+#include <string>
 
 // C++
 #include <algorithm>
diff --git a/src/KsPlotTools.hpp b/src/KsPlotTools.hpp
index 75fb4da..c66fea3 100644
--- a/src/KsPlotTools.hpp
+++ b/src/KsPlotTools.hpp
@@ -14,6 +14,7 @@ 
 
 // C
 #include <math.h>
+#include <string>
 
 // C++
 #include <limits>
diff --git a/src/KsUtils.hpp b/src/KsUtils.hpp
index cfb45f4..5857099 100644
--- a/src/KsUtils.hpp
+++ b/src/KsUtils.hpp
@@ -36,7 +36,7 @@ 
 
 //! @cond Doxygen_Suppress
 
-auto fontHeight = []()
+inline auto fontHeight = []()
 {
 	QFont font;
 	QFontMetrics fm(font);
@@ -44,7 +44,7 @@  auto fontHeight = []()
 	return fm.height();
 };
 
-auto stringWidth = [](QString s)
+inline auto stringWidth = [](QString s)
 {
 	QFont font;
 	QFontMetrics fm(font);