When I try to compile a simple boost application with
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
headers in VS 2010, I get the this error message.
c:\program files\boost\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::mapped_region' to 'boost::interprocess::mapped_region &&'
1> You cannot bind an lvalue to an rvalue reference
1> c:\program files\boost\boost_1_44_0\boost\interprocess\mapped_region.hpp(159) : see reference to function template instantiation 'boost::interprocess::mapped_region &&boost::interprocess::move<boost::interprocess::mapped_region&>(T)' being compiled
1> with
1> [
1> T=boost::interprocess::mapped_region &
1> ]
1>c:\program files\boost\boost_1_44_0\boost\interprocess\detail\move.hpp(342): error C2440: 'return' : cannot convert from 'boost::interprocess::shared_memory_object' to 'boost::interprocess::shared_memory_object &&'
1> You cannot bind an lvalue to an rvalue reference
1> c:\program files\boost\boost_1_44_0\boost\interprocess\shared_memory_object.hpp(85) : see reference to function template instantiation 'boost::interprocess::shared_memory_object &&boost::interprocess::move<boost::interprocess::shared_memory_object&>(T)' being compiled
1> with
1> [
1> T=boost::interprocess::shared_memory_object &
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I couldn't understand what the problem. I deleted all the function implementations, there are only c_tor and d_tor but still the same error..
You can work around this as shown here. It looks like a limitation in either Boost or the compiler in handling rvalue references.
#define BOOST_NO_RVALUE_REFERENCES
worked. Thanks.
Related
I have a TensorFlow Lite C API library that I am using on Windows and I want it to use a GPU delegate. I do not have any trouble compiling the TensorFlow Lite C API library with bazel on my Windows machine, but I cannot get the GPU delegate to compile.
TensorFlow version: 2.10.0
Windows version: 10.0.19044
Even though TFLite does not support the Windows platform there is a clear indication that it should be possible to compile a GPU delegate for the Windows platform using ANGLE library (see https://github.com/tensorflow/tensorflow/issues/28830#issuecomment-522325199).
It feels like I am close to the solution but I must be missing something fundamental. I am quite new to most of the tools and concepts involved, but I managed to stitch together the following procedure:
Installed ANGLE according to https://chromium.googlesource.com/angle/angle/+/main/doc/DevSetup.md (COMMIT=596c2acfa5071eb643eaffe855a5ccb51c345427)
Built ANGLE libraries with following args (args.gn):
is_component_build = false
target_cpu = "x64"
is_debug = false
angle_assert_always_on = false
Added ANGLE build output directory (containing libEGL.dll, libEGL.dll.lib, libGLESv2.dll, libGLESv2.dll.lib, d3dcompiler_47.dll) to PATH environment variable.
Added ANGLE library dependency in bazel:
In WORKSPACE file:
new_local_repository(
name = "angle",
path = "../../../angle/angle/include",
build_file_content = """
package(default_visibility = ["//visibility:public"])
cc_library(
name = "headers",
srcs = glob(["**/*.h"])
)
"""
)
Added necessary dependencies (copts = ["-Iexternal/angle"] and "#angle//:headers") to targets in bazel BUILD files (all targets that failed compilation due to missing OpenGL headers):
Example:
cc_library(
name = "gl_errors",
srcs = ["gl_errors.cc"],
hdrs = ["gl_errors.h"],
copts = ["-Iexternal/angle"], <--- ADDED THIS
deps = [
"#angle//:headers", <--- ADDED THIS
":portable",
"//tensorflow/lite/delegates/gpu/common:status",
"#com_google_absl//absl/strings",
],
)
Updated .bazel to use '/std:c++latest'
---build:windows --cxxopt=/std:c++17
---build:windows --host_cxxopt=/std:c++17
+++build:windows --cxxopt=/std:c++latest
+++build:windows --host_cxxopt=/std:c++latest
Build TensorFlow Lite GPU delegate (v2.10.0) //tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so
bazel2 build --local_cpu_resources=3 --features=windows_export_all_symbols -s -c opt --copt="-DMESA_EGL_NO_X11_HEADERS" --copt="-DEGL_NO_X11" //tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so
I expected to get the two files libtensorflowlite_gpu_delegate.so.dll and libtensorflowlite_gpu_delegate.so.if.lib but I get errors that I do not know how to mitigate.
ERROR: C:/users/magnusg/src/tensorflow_lite/tflite_2.10.0_gpu_delegate_build_bazel/tensorflow_src/tensorflow/lite/delegates/gpu/cl/kernels/BUILD:129:11: Compiling tensorflow/lite/delegates/gpu/cl/kernels/converter.cc failed: (Exit 2): cl.exe failed: error executing command
cd /d C:/users/magnusg/_bazel_magnusg/4du655w4/execroot/org_tensorflow
SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\cppwinrt
SET PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\devinit;C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x64;C:\Program Files (x86)\Windows Kits\10\bin\x64;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\\MSBuild\Current\Bin;c:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\;;C:\Windows\system32;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja
SET PWD=/proc/self/cwd
SET PYTHON_BIN_PATH=C:/Users/magnusg/anaconda3/envs/sa/python.exe
SET PYTHON_LIB_PATH=C:/Users/magnusg/anaconda3/envs/sa/lib/site-packages
SET RUNFILES_MANIFEST_ONLY=1
SET TEMP=C:\Users\magnusg\AppData\Local\Temp
SET TF2_BEHAVIOR=1
SET TMP=C:\Users\magnusg\AppData\Local\Temp
SET avariable=3
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe #bazel-out/x64_windows-opt/bin/tensorflow/lite/delegates/gpu/cl/kernels/_objs/converter/converter.obj.params
# Configuration: 4692499b740a707abb55d09dbd7c915fbefe7b433a9f783356c086c94c980334
# Execution platform: #local_execution_config_platform//:platform
cl : Command line warning D9035 : option 'experimental:preprocessor' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'Zc:preprocessor' instead of 'experimental:preprocessor'
cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(526): error C2059: syntax error: '__cdecl'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(532): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(532): error C2165: 'left-side modifier': cannot modify pointers to data
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(532): error C2513: 'cl_int *': no variable declared before '='
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(535): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(535): error C2165: 'left-side modifier': cannot modify pointers to data
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(535): error C2513: 'cl_int *': no variable declared before '='
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(538): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(538): error C2165: 'left-side modifier': cannot modify pointers to data
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(538): error C2513: 'cl_int *': no variable declared before '='
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(542): error C2061: syntax error: identifier 'cl_command_buffer_khr'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(547): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(548): error C2275: 'cl_command_queue': illegal use of this type as an expression
external/angle\CL/cl.h(32): note: see declaration of 'cl_command_queue'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(549): error C2059: syntax error: 'const'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(559): error C2065: 'cl_command_buffer_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(560): error C2065: 'cl_command_buffer_info_khr': undeclared identifier
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(560): error C2275: 'size_t': illegal use of this type as an expression
tensorflow/lite/delegates/gpu/cl/kernels/converter.cc: note: see declaration of 'size_t'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(561): error C2062: type 'void' unexpected
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(682): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(682): error C2146: syntax error: missing ';' before identifier 'clCreateCommandBufferKHR'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(687): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(687): error C2146: syntax error: missing ';' before identifier 'clCommandNDRangeKernelKHR'
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(688): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.\tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h(688): error C2146: syntax error: missing ';' before identifier 'clGetCommandBufferInfoKHR'
Target //tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so failed to build
INFO: Elapsed time: 375.856s, Critical Path: 62.04s
INFO: 686 processes: 15 internal, 671 local.
FAILED: Build did NOT complete successfully
I do not know if I am on the right track and simply missing a minor detail or if I am missing the target completely. Any feedback would be helpful.
Hi i am getting the following error while building Qt application Test2 in Visual Studio 2015 comm. edn.
1>------ Rebuild All started: Project: Test2, Configuration: Debug Win32 ------
1> Moc'ing test2.h...
1> The filename, directory name, or volume label syntax is incorrect.
1> Uic'ing test2.ui...
1> The filename, directory name, or volume label syntax is incorrect.
1> Rcc'ing test2.qrc...
1> The filename, directory name, or volume label syntax is incorrect.
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error
MSB6006: "cmd.exe" exited with code 123.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Please help me to resolve this issue.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm trying to compile this simple example https://github.com/zaphoyd/websocketpp/blob/master/examples/echo_server/echo_server.cpp from the developer github, but I'm getting strange errors outside the code.
I have also tried turning on the /Za option as shown in this post: VC++ 2012 and Boost incompatibility - `throw()` specifications in library headers but it throws a different error, saying "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"
Does someone know how to fix this?
thanks!
The errors:
I'm using Visual Studio 2015 in Windows10 x64,
C:\websocketpp\websocketpp/transport/base/connection.hpp(187): error C2694: 'const char *websocketpp::transport::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'
1> C:\websocketpp\websocketpp/transport/base/connection.hpp(187): note: see declaration of 'websocketpp::transport::error::category::name'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'
1>C:\websocketpp\websocketpp/transport/iostream/base.hpp(89): error C2694: 'const char *websocketpp::transport::iostream::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'
1> C:\websocketpp\websocketpp/transport/iostream/base.hpp(89): note: see declaration of 'websocketpp::transport::iostream::error::category::name'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'
1>C:\websocketpp\websocketpp/error.hpp(151): error C2694: 'const char *websocketpp::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'
1> C:\websocketpp\websocketpp/error.hpp(151): note: see declaration of 'websocketpp::error::category::name'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'
1>C:\websocketpp\websocketpp/frame.hpp(831): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data
1>C:\websocketpp\websocketpp/extensions/extension.hpp(65): error C2694: 'const char *websocketpp::extensions::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'
1> C:\websocketpp\websocketpp/extensions/extension.hpp(65): note: see declaration of 'websocketpp::extensions::error::category::name'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'
1>C:\local\boost_1_59_0\boost/asio/detail/config.hpp(227): warning C4005: 'BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT': macro redefinition
1> C:\local\boost_1_59_0\boost/asio/detail/config.hpp(213): note: see previous definition of 'BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT'
1>C:\websocketpp\websocketpp/transport/asio/base.hpp(189): error C2694: 'const char *websocketpp::transport::asio::error::category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'
1> C:\websocketpp\websocketpp/transport/asio/base.hpp(189): note: see declaration of 'websocketpp::transport::asio::error::category::name'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'
1>C:\websocketpp\websocketpp/transport/asio/security/base.hpp(109): error C2694: 'const char *websocketpp::transport::asio::socket::socket_category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'
1> C:\websocketpp\websocketpp/transport/asio/security/base.hpp(109): note: see declaration of 'websocketpp::transport::asio::socket::socket_category::name'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'
1>C:\websocketpp\websocketpp/processors/base.hpp(165): error C2694: 'const char *websocketpp::processor::error::processor_category::name(void) const': overriding virtual function has less restrictive exception specification than base class virtual member function 'const char *std::error_category::name(void) noexcept const'
1> C:\websocketpp\websocketpp/processors/base.hpp(165): note: see declaration of 'websocketpp::processor::error::processor_category::name'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\system_error(167): note: see declaration of 'std::error_category::name'
1>C:\websocketpp\websocketpp/common/md5.hpp(367): warning C4267: '+=': conversion from 'size_t' to 'websocketpp::md5::md5_word_t', possible loss of data
1>C:\websocketpp\websocketpp/sha1/sha1.hpp(176): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Defining _WEBSOCKETPP_NOEXCEPT_ and _WEBSOCKETPP_CPP11_CHRONO_ did the trick for me :)
https://github.com/zaphoyd/websocketpp/issues/437
I am using below snippet in my code.
//from Vista WinNT.h
//
typedef struct _TOKEN_MANDATORY_LABEL {
SID_AND_ATTRIBUTES Label;
} TOKEN_MANDATORY_LABEL, *PTOKEN_MANDATORY_LABEL;
When I build this through VS2005 it give no error. But when I am building using make file i am getting below error in cmd:
Test.cpp(337) : error C2011: '_TOKEN_MANDATORY_LABEL' : 'struct' type redefinition
C:\Program Files\Microsoft SDKs\Windows\v6.1\include\winnt.h(7351) : see declaration of '_TOKEN_MANDATORY_LABEL'
I am using Opus software to use make file. Please let me know if I am missing something or needs to add some libs to overcome this error.
I am compiling my C source code in MS visual Studio C++ 2010.I am getting following following errors while building. What can be the reasons for it?
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/time.h(18): error C2061: syntax error : identifier 'suseconds_t'
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/time.h(19): error C2059: syntax error : '}'
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/time.h(37): error C2079: 'it_interval' uses undefined struct 'timeval'
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/time.h(38): error C2079: 'it_value' uses undefined struct 'timeval'
[EDIT ]
Following is the code in my program:
#ifndef _DWORD_DEFINED
#define _DWORD_DEFINED
typedef unsigned long DWORD;
#endif
int getTime(struct timeval * tp, void * tzp)
{
DWORD milliseconds;
milliseconds = timeGetTime();
tp->tv_sec = milliseconds / 1000;
tp->tv_usec = (milliseconds % 1000) * 1000;
return 0;
}
Without any code, all I can say is this:
The first error cause is this.
The second error cause is this.
The third and fourth error cause is this.
Edit: After the OP's edit, the errors are more than obvious. Look at the struct timeval.
Where is it's definition? You access members of that struct and still you there is no visible definition of the struct.