Mono p/invoke giving 'undefined symbol __dso_handle' - mono

I added the .so to LDConfig following this article. Still getting the following. You can get the source for the code here. Here is the log from the startup of the binary.
MONO_LOG_LEVEL=debug mono 39dll-4-linux.exe
Mono: gc took 20 usecs
Mono: Assembly Loader probing location: '/usr/lib/mono/4.0/mscorlib.dll'.
Mono: Image addref mscorlib[0x1bd58e0] -> /usr/lib/mono/4.0/mscorlib.dll[0x1bd4c10]: 2
Mono: AOT failed to load AOT module /usr/lib/mono/4.0/mscorlib.dll.so: /usr/lib/mono/4.0/mscorlib.dll.so: cannot open shared object file: No such file or directory
Mono: Assembly Loader loaded assembly from location: '/usr/lib/mono/4.0/mscorlib.dll'.
Mono: Config attempting to parse: '/usr/lib/mono/4.0/mscorlib.dll.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/mscorlib/mscorlib.config'.
Mono: Assembly mscorlib[0x1bd58e0] added to domain 39dll-4-linux.exe, ref_count=1
Mono: Config attempting to parse: '/etc/mono/config'.
Mono: Config attempting to parse: '/home/nick/.mono/config'.
Mono: Assembly Loader probing location: '39dll-4-linux.exe'.
Mono: Image addref 39dll-4-linux[0x1c520f0] -> /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe[0x1bd3980]: 3
Mono: Assembly 39dll-4-linux[0x1c520f0] added to domain 39dll-4-linux.exe, ref_count=1
Mono: AOT failed to load AOT module /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.so: /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.so: cannot open shared object file: No such file or directory
Mono: Assembly Loader loaded assembly from location: '39dll-4-linux.exe'.
Mono: Config attempting to parse: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.config'.
Mono: Config attempting to parse: '/etc/mono/assemblies/39dll-4-linux/39dll-4-linux.config'.
Mono: Assembly Loader probing location: '39dll-4-linux.exe'.
Mono: AOT failed to load AOT module /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.so: /home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/39dll-4-linux.exe.so: cannot open shared object file: No such file or directory
Mono: Assembly Ref addref 39dll-4-linux[0x1c520f0] -> mscorlib[0x1bd58e0]: 2
Mono: DllImport attempting to load: 'libWinsockLib'.
Mono: DllImport loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib'.
Mono: DllImport error loading library '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so'.
Mono: DllImport error loading library '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so: undefined symbol: __dso_handle'.
Mono: DllImport loading location: 'libWinsockLib'.
Mono: DllImport error loading library: 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport loading location: 'libWinsockLib.so'.
Mono: DllImport error loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so: undefined symbol: __dso_handle'.
Mono: DllImport loading: 'libWinsockLib'.
Mono: DllImport error loading library 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport unable to load library 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport attempting to load: 'libWinsockLib'.
Mono: DllImport loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib'.
Mono: DllImport error loading library '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so'.
Mono: DllImport error loading library '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so: undefined symbol: __dso_handle'.
Mono: DllImport loading location: 'libWinsockLib'.
Mono: DllImport error loading library: 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport loading location: 'libWinsockLib.so'.
Mono: DllImport error loading library: '/home/nick/Projects/39dll-4-linux/39dll-4-linux/bin/Debug/libWinsockLib.so: undefined symbol: __dso_handle'.
Mono: DllImport loading: 'libWinsockLib'.
Mono: DllImport error loading library 'libWinsockLib: cannot open shared object file: No such file or directory'.
Mono: DllImport unable to load library 'libWinsockLib: cannot open shared object file: No such file or directory'.
Unhandled Exception: System.DllNotFoundException: libWinsockLib
at (wrapper managed-to-native) dll4linux.Net:dllInit ()
at dll4linux.SockLib.Init () [0x00000] in <filename unknown>:0
at dll4linux.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libWinsockLib
at (wrapper managed-to-native) dll4linux.Net:dllInit ()
at dll4linux.SockLib.Init () [0x00000] in <filename unknown>:0
at dll4linux.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
I am completely stumped. Any ideas as to whats going wrong?
FYI, I am invoking the following C# code:
[DllImport("libWinsockLib", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dllInit")]
public static extern Double dllInit();
Finally, I used the following build commands to build the 39dll-4-linux project:
Executed for each .cpp file:
g++ -fPIC -c -o obj/<filename>.o <filename>.cpp
Then I executed:
ld -G obj/*.o -o 39dll4linux.so

Never mind! I figured it out. Turns out, ld is not a good way to package and link a shared library.
Instead of the ld command, i used:
g++ -shared obj/*.o -o 39dll-4-linux.so
It works like a charm!

Related

WinUI3/Desktop/C++: Can't compile winrt::resume_foreground(Microsoft::System::DispatcherQueue const& dispatcher)

I want to use:
co_await winrt::resume_foreground(window.DispatcherQueue());
(Type of "window" is: "winrt::Microsoft::UI::Xaml::Window")
But I cannot compile it because
winrt::resume_foreground(Microsoft::System::DispatcherQueue const& dispatcher)
is not defined.
I cannot include #include <winrt/Microsoft.System.h> which contains the DispatcherQueue class.
My environment:
Windows 10 Pro, 21H1, 19043.1083
Visual Studio Community 2019 (16.10.3)
Visual Studio Extension: Project Reunion Version 0.8.0.46122163
Project Template: C++, Blank App, Packaged (WinUI 3 in Desktop)
To reproduce the error I used the Project Template above and added the following method to the "App" class.
App.xaml.h
winrt::Windows::Foundation::IAsyncAction foo();
App.xaml.cpp
winrt::Windows::Foundation::IAsyncAction App::foo()
{
co_await winrt::resume_foreground(window.DispatcherQueue());
}
I get the error message:
D:\Solution\WinUi3 Test\WinUi3 Test\App.xaml.cpp(50,21): error C2039: 'resume_foreground': is not a member of 'winrt'
1>D:\Solution\WinUi3 Test\WinUi3 Test\MainWindow.xaml.h(23): message : see declaration of 'winrt'
1>D:\Solution\WinUi3 Test\WinUi3 Test\App.xaml.cpp(50,38): error C3861: 'resume_foreground': identifier not found
1>Done building project "WinUi3 Test.vcxproj" -- FAILED.
If I try to include #include <winrt/Microsoft.System.h> I get:
1>D:\Solution\WinUi3 Test\WinUi3 Test\pch.h(25,10): fatal error C1083: Cannot open include file: 'winrt/Microsoft.System.h': No such file or directory
1>Done building project "WinUi3 Test.vcxproj" -- FAILED.
If I include #include <winrt/Windows.System.h> and #include <winrt/Windows.UI.Core.h> I get:
1>D:\Solution\WinUi3 Test\WinUi3 Test\App.xaml.cpp(50,63): error C2665: 'winrt::resume_foreground': none of the 2 overloads could convert all the argument types
1>D:\Solution\WinUi3 Test\WinUi3 Test\Generated Files\winrt\Windows.UI.Core.h(2805,31): message : could be 'winrt::resume_foreground::awaitable winrt::resume_foreground(const winrt::Windows::UI::Core::CoreDispatcher &,const winrt::Windows::UI::Core::CoreDispatcherPriority) noexcept' (compiling source file App.xaml.cpp)
1>D:\Solution\WinUi3 Test\WinUi3 Test\Generated Files\winrt\Windows.System.h(4529,31): message : or 'winrt::resume_foreground::awaitable winrt::resume_foreground(const winrt::Windows::System::DispatcherQueue &,const winrt::Windows::System::DispatcherQueuePriority) noexcept' (compiling source file App.xaml.cpp)
1>D:\Solution\WinUi3 Test\WinUi3 Test\App.xaml.cpp(50,63): message : while trying to match the argument list '(winrt::Microsoft::UI::Dispatching::DispatcherQueue)'
1>Done building project "WinUi3 Test.vcxproj" -- FAILED.
Include
#include <winrt/Microsoft.UI.Dispatching.h>
#include <Microsoft.UI.Dispatching.co_await.h>
When updating from 0.8.0 preview to 0.8.0 there was a namespace change from
Microsoft.System to Microsoft.UI.Dispatching and resume_foreground is now defined in Microsoft.UI.Dispatching.co_await.h.
The answer from Markus does not work for me in the WinUI3 1.0 release because the Microsoft.UI.Dispatching.co_await.h header file does not exist. However, the following does work:
#include <wil/cppwinrt.h>
#include <wil/cppwinrt_helpers.h>
co_await wil::resume_foreground(DispatcherQueue());

CMake 3.16.x not building gRPC 1.23/1.26 anymore on Windows 10 (VS 2017)

My team and I are building gRPC using CMake. We have been building gRPC v1.26 (and v1.23 too) just fine with CMake 3.15.6, but since CMake 3.16.x is not building anymore.
This is the log of the tools we are using:
[29/32 0.2/sec] Performing configure step for 'grpc'
loading initial cache file C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/tmp/grpc-cache-Debug.cmake
-- The C compiler identification is MSVC 19.16.27034.0
-- The CXX compiler identification is MSVC 19.16.27034.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Protobuf: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/install/external/lib/libprotobufd.lib (found version "3.8.0")
-- Found OpenSSL: optimized;C:/Program Files/OpenSSL-Win64/lib/VC/libcrypto64MD.lib;debug;C:/Program Files/OpenSSL-Win64/lib/VC/libcrypto64MDd.lib (found version "1.1.1d")
-- Found ZLIB: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/install/external/lib/zlibd.lib (found version "1.2.11")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-build
After configure step, something fails in the build step. However as it can be seen the building process does not stop.
[30/32 0.1/sec] Performing build step for 'grpc'
FAILED: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-stamp/grpc-build
cmd.exe /C "cd /D C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\_deps\grpc_src-build\grpc\src\grpc-build && "C:\Program Files\CMake\bin\cmake.exe" --build . && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-stamp/grpc-build"
[1/1580 1.3/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\udp_server.cc.obj
[2/1580 2.5/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\timer_heap.cc.obj
[3/1580 3.3/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\timer.cc.obj
It builds a lot of objects until it starts showing strange warnings as follows, but it still keeps building.
[975/1580 5.8/sec] Linking CXX static library gpr.lib
[976/1580 5.8/sec] Linking C static library address_sorting.lib
[977/1580 5.8/sec] Building CXX object CMakeFiles\grpc.dir\src\core\lib\backoff\backoff.cc.obj
...
[982/1580 5.8/sec] Building CXX object CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj
C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\include\google/protobuf/stubs/logging.h(102): warning C4251: 'google::protobuf::internal::LogMessage::message_': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'google::protobuf::internal::LogMessage'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xstring(4373): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\include\google/protobuf/arena_impl.h(251): warning C4251: 'google::protobuf::internal::ArenaImpl::lifecycle_id_generator_': struct 'std::atomic<__int64>' needs to have dll-interface to be used by clients of class 'google::protobuf::internal::ArenaImpl'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xxatomic(162): note: see declaration of 'std::atomic<__int64>'
More warnings are shown as follows:
[1531/1580 5.5/sec] Building CXX object CMakeFiles\grpc_print_google_default_creds_token.dir\test\core\security\print_google_default_creds_token.cc.obj
[1532/1580 5.5/sec] Linking CXX static library grpc++.lib
server_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
rpc_method.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
create_channel_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
[1533/1580 5.5/sec] Linking CXX static library grpc_plugin_support.lib
[1534/1580 5.5/sec] Building CXX object CMakeFiles\grpc_create_jwt.dir\test\core\security\create_jwt.cc.obj
[1535/1580 5.5/sec] Linking CXX static library grpc++_unsecure.lib
server_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
rpc_method.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
create_channel_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
[1536/1580 5.5/sec] Building CXX object CMakeFiles\grpc_create_jwt.dir\test\core\util\cmdline.cc.obj
[1537/1580 5.5/sec] Linking CXX executable grpc_ruby_plugin.exe
FAILED: grpc_ruby_plugin.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\grpc_ruby_plugin.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100177~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100177~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MICROS~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj /out:grpc_ruby_plugin.exe /implib:grpc_ruby_plugin.lib /pdb:grpc_ruby_plugin.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib grpc_plugin_support.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj /out:grpc_ruby_plugin.exe /implib:grpc_ruby_plugin.lib /pdb:grpc_ruby_plugin.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib grpc_plugin_support.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\grpc_ruby_plugin.dir/intermediate.manifest CMakeFiles\grpc_ruby_plugin.dir/manifest.res" failed (exit code 1120) with the following output:
ruby_plugin.cc.obj : warning LNK4217: locally defined symbol ?name#FileDescriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ (public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::FileDescriptor::name(void)const ) imported in function "bool __cdecl grpc_ruby_generator::ServicesFilename(class google::protobuf::FileDescriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?ServicesFilename#grpc_ruby_generator##YA_NPEBVFileDescriptor#protobuf#google##PEAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
grpc_plugin_support.lib(ruby_generator.cc.obj) : warning LNK4049: locally defined symbol ?name#FileDescriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ (public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::FileDescriptor::name(void)const ) imported
ruby_plugin.cc.obj : warning LNK4217: locally defined symbol ??0CodedOutputStream#io#protobuf#google##QEAA#PEAVZeroCopyOutputStream#123##Z (public: __cdecl google::protobuf::io::CodedOutputStream::CodedOutputStream(class google::protobuf::io::ZeroCopyOutputStream *)) imported in function "public: virtual bool __cdecl RubyGrpcGenerator::Generate(class google::protobuf::FileDescriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class google::protobuf::compiler::GeneratorContext *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)const " (?Generate#RubyGrpcGenerator##UEBA_NPEBVFileDescriptor#protobuf#google##AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PEAVGeneratorContext#compiler#34#PEAV56##Z)
Build stops after a lot of the above warnings with the following log:
ruby_plugin.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public:
__cdecl google::protobuf::compiler::CodeGenerator::CodeGenerator(void)" (__imp_??0CodeGenerator#compiler#protobuf#google##QEAA#XZ) referenced in function "public: __cdecl RubyGrpcGenerator::RubyGrpcGenerator(void)" (??0RubyGrpcGenerator##QEAA#XZ)
ruby_plugin.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl google::protobuf::compiler::PluginMain(int,char * * const,class google::protobuf::compiler::CodeGenerator const *)" (__imp_?PluginMain#compiler#protobuf#google##YAHHQEAPEADPEBVCodeGenerator#123##Z) referenced in function "int __cdecl grpc::protobuf::compiler::PluginMain(int,char * * const,class google::protobuf::compiler::CodeGenerator const *)" (?PluginMain#compiler#protobuf#grpc##YAHHQEAPEADPEBVCodeGenerator#12google###Z)
grpc_plugin_support.lib(ruby_generator.cc.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::Descriptor::name(void)const " (__imp_?name#Descriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl grpc_ruby_generator::RubyTypeOf(class google::protobuf::Descriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?RubyTypeOf#grpc_ruby_generator##YA?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PEBVDescriptor#protobuf#google##AEBV23##Z)
The only thing changed between working build and not working one is: removing build folder, uninstall CMake 3.15.x, reboot, install CMake 3.16.0, build grpc all over again.
Anyone faced something like this? Thank you

cmake not linking my class I think, mistakes in cmakelists.text likely culprit

I think, I may have improperly set up cmake wrong,(or improperly set up cmake for that matter) or I'm bad and rusty at C++ or both and possibly more. I just want to add a header and separate code into a class that loads images for opengl. I also put them in another directory parallel to other libraries in my linux file tree.
The main project folder has the main cmakelists.text file in it it's called "maficengine". Inside it are also a "build" file a "common" file and "external" file and a file called "Mafic", "maficGuiSourceFiles" file and one called "distrib." I think we can just focus on 2. "mafic" and "external". Inside mafic I have one called mafic.cpp which has my main function and is the entry point. Inside external, there is another folder called "myCustomHeaders".. therein lies a file called "loadTexture.cpp" It contains the loadTexture class declaration and definition. Also inside "myCustomHeaders" there is an "include" file which contains "loadTexture.h"... I cannot seem to instanciate an instance of LoadTexture lt; and call the function of loadtexture(); I expect it to at line 187 in mafic.cpp
#cmakelists.text file from main project folder
# CMake entry point
cmake_minimum_required (VERSION 3.0)
project (maficengine )
find_package(OpenGL REQUIRED)
add_library(loaders
external/myCustomHeaders/loadTexture.cpp
external/myCustomHeaders/include/loadTexture.h
)
set(SOURCES external/myCustomHeaders/loadTexture.cpp )
# Compile external dependencies
add_subdirectory (external)
# On Visual 2005 and above, this module can set the debug working directory
cmake_policy(SET CMP0026 OLD)
cmake_policy(SET CMP0079 NEW)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external/rpavlik-cmake-modules-fe2273")
include(CreateLaunchers)
include(MSVCMultipleProcessCompile) # /MP
if(INCLUDE_DISTRIB)
add_subdirectory(distrib)
endif(INCLUDE_DISTRIB)
include_directories(
external/AntTweakBar-1.16/include/
external/glfw-3.1.2/include/
external/glm-0.9.7.1/
external/glew-1.13.0/include/
external/assimp-3.0.1270/include/
external/bullet-2.81-rev2613/src/
external/myCustomHeaders/include
common/
)
set(ALL_LIBS
${OPENGL_LIBRARY}
glfw
GLEW_1130
loaders
)
add_definitions(
-DTW_STATIC
-DTW_NO_LIB_PRAGMA
-DTW_NO_DIRECT3D
-DGLEW_STATIC
-D_CRT_SECURE_NO_WARNINGS
)
# Tutorial 17
add_executable(mageengine
Mafic/mafic.cpp
common/shader.cpp
common/shader.hpp
common/controls.cpp
common/controls.hpp
common/texture.cpp
common/texture.hpp
common/objloader.cpp
common/objloader.hpp
common/vboindexer.cpp
common/vboindexer.hpp
common/quaternion_utils.cpp
common/quaternion_utils.hpp
#Mafic/loadTexture.h
#Mafic/loadTexture.cpp
Mafic/StandardShading.vertexshader
Mafic/StandardShading.fragmentshader
)
target_link_libraries(mageengine
${ALL_LIBS}
ANTTWEAKBAR_116_OGLCORE_GLFW
loaders
)
here's mafic.cpp
#include <loadTexture.h>
int main( void )
{
loadTexture lt;
lt.loadtexture();
}
here's my loadTexture.cpp
class loadTexture
{
public:
loadTexture();
~loadTexture();
void loadtexture(){
fprintf(stdout, "loadtexture does something, that's a positive result for this test");
}
};
and finally my loadTexture.h
[code]
#pragma once
#include <GL/glew.h>
//GLuint image;
void loadtexture();
[/code]
Hoping it would build with no errors but I get ...
aaron#Zog:~/Desktop/maficengine/build$ make
[ 2%] Built target ANTTWEAKBAR_116_OGLCORE_GLFW
[ 2%] Built target GLEW_1130
[ 2%] Built target loaders
[ 6%] Built target glfw
[ 7%] Building CXX object CMakeFiles/mageengine.dir/Mafic/mafic.cpp.o
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp:1:9: warning: #pragma once in main file
#pragma once
^~~~
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp: In function ‘int main()’:
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp:187:1: error: ‘loadTexture’ was not declared in this scope
loadTexture lt;
^~~~~~~~~~~
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp:187:1: note: suggested alternative: ‘loadtexture’
loadTexture lt;
^~~~~~~~~~~
loadtexture
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp:189:2: error: ‘lt’ was not declared in this scope
lt.loadtexture();
^~
CMakeFiles/mageengine.dir/build.make:62: recipe for target 'CMakeFiles/mageengine.dir/Mafic/mafic.cpp.o' failed
make[2]: *** [CMakeFiles/mageengine.dir/Mafic/mafic.cpp.o] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/mageengine.dir/all' failed
make[1]: *** [CMakeFiles/mageengine.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
aaron#Zog:~/Desktop/maficengine/build$

QT 5 QPrinter linq error

I use QT 5.1.1 and Qt Creator 2.8.1
I want use printer:
QPrinter printer(QPrinter::HighResolution);
QPrintDialog printdialog(&printer,this);
if (printdialog.exec() == QDialog::Accepted)
{
QTextDocument doc;
doc.setHtml(s);
doc.print(&printer);
}
And I get this error:
DictionaryWidget.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: _thiscall QPrinter::QPrinter(enum QPrinter::PrinterMode)" (_imp_??0QPrinter##QAE#W4PrinterMode#0##Z) referenced in function "private: void __thiscall DictionaryWidget::on_pbPrint_clicked(void)" (?on_pbPrint_clicked#DictionaryWidget##AAEXXZ)
in .pro file I have:
QT += core gui xml printsupport
to build Environment in QT Creator LIBPATH as follows:
libpath: C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framewo‌​rk64\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\References\CommonConfigura‌​tion\neutral;C:\Qt\5.1.1\msvc2012\lib;
In the folder C:\Qt\5.1.1\msvc2012\lib file is located Qt5PrintSupport.lib
What should I do to make the project work?

OpenCV highgui110.dll Link Error

i encounter an error like
Error 1 fatal error LNK1107: invalid or corrupt file: cannot read at 0x2C8 C:\Program Files\OpenCV\bin\highgui110.dll
Additional Include Directories
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cv\include
Additional Library Directories
C:\Program Files\OpenCV\otherlibs
C:\Program Files\OpenCV\lib
C:\Program Files\OpenCV\bin
Additional Dependencies
cv.lib
highgui.lib
cxcore.lib
highgui110.dll
Error Message is
Error 1 fatal error LNK1107: invalid or corrupt file: cannot read at 0x2C8 C:\Program Files\OpenCV\bin\highgui110.dll 1 OpenCV Capture
What wrong with highgui.dll ?
Please help.
Thanks.
This is my source code.
Code:
#ifndef CAM_CAPTURE_H
#define CAM_CAPTURE_H
#include "cv.h"
#include "highgui.h"
class CamCapture
{
private:
CvCapture* myCaptureHandler;
IplImage* videoFrame;
int key;
public:
CamCapture();
~CamCapture();
void Init();
};
#endif
Remove highgui110.dll from your list of Additional dependencies. In additional dependencies you should list only lib files.