I am trying to make a simple rendering engine using opengl & freeglut. I am doing the rendering engine part in a seperate c++ project under the same solution and compiling it as a DLL, then using it in the "main" engine project.
I am having some trouble when I try to initialize the rendering engine. It complains about not being able to find MSVCP140D_APP.dll and VCRUNTIME140D_APP.dll
I know these dll's are related to microsoft visual C++ redist package, but I do have the very newest version installed. Could this be something wrong with my project properties on my Rendering Project?
Image of solution setup
Related
There's a great article here that describes how to use native C++ libraries in Xamarin/C#, and I would assume that this would extend to MAUI: https://learn.microsoft.com/en-us/xamarin/cross-platform/cpp/
I followed these instructions, and put together an end-to-end demo solution of it here: https://github.com/whodges/bindingsample. This does require that you link Visual Studio to a MacBook to build the full solution.
That example essentially uses the default MAUI template, and modifies it slightly so that the actual 'click counter' value is set and retrieved from a native library on a per-platform basis. For Windows, that's a C++ DLL (works great). For Android, that's a .so library (works great). And for iOS, that's a static .a library, and here's where I'm running into trouble: when I try to launch this app using the iOS Simulator, it fails with a clang++ error, and something along the lines of "Could not extract the native library 'libCounteriOS.a' from .../obj/Debug/net6.0-ios/iossimulator-x64/linker-cache/libCounteriOS.a'. Please ensure the native library was properly embedded in the managed assembly (if the assembly was built using a binding project, the native library must be included in the project, and its Build Action must be 'ObjcBindingNativeLibrary')".
I created a C# .NET iOS Binding Library project (Counter.iOS in my example), and this is supposed to bundle libCounteriOS.a, which is generated when CounteriOS (a C++ project) is compiled. First, when Counter.iOS is built using Visual Studio on Windows, it fails to generate the Counter.resources folder in its 'bin' folder, along with the subsequent 'manifest' file. When I use Visual Studio for Mac, these files do get generated. So, I stuck with Visual Studio for Mac to build the iOS.Counter project (everything else is built with Visual Studio on Windows).
Regardless, I still get the "could not extract the native library" error I described. I've tried setting the library file's Build Action in Counter.iOS to ObjcBindingNativeLibrary, but that just results in an unhelpful "Build failed - see build log for details" error in Visual Studio for Mac, and I cannot find said log file for the life of me. On top of that, it's not an Objective C library anyway - it's a C++ one - so I'm not sure if this step is actually appropriate. Does it have to be Objective C? The Xamarin article suggests otherwise, and the native reference option 'Is C++' is there as well. I've also tried setting libCounteriOS.a's Build Action to 'BundleResource' - no luck with that either. I've tried it with .NET 7.0 as well - also no luck there.
I'm really at a loss. Is this even possible? It doesn't seem to work and I've been poking at it for weeks on it. That Xamarin article seems to suggest it should be possible. Any help would be greatly appreciated.
I am writing a cross platform application in C++ that is creating some plots. For GUI I am using wxWidgets 3.1.3 and for plots wxMathPlot.
On linux it works great but on Windows I get the following error:
...\src\msw\window.cpp[3994]:assert "wclass" failed in wxWindow::MSWCreate(): failed to register window class?
I am using Visual Studio 2019. The error is present on both Debug and Release, but only when I am using wxMathPlot as DLL.
I've tried to recompile wxWidgets and to add propriety sheet from wxWidgets to wxMathPlot project but I get the same error.
It's not a requirement of the project to use wxMathPlot as DLL but I am curious on why this behavior happens.
It's not clear if you use wxWidgets as a DLL as well, but you really need to do it in order for it to work, i.e. both the mathplot DLL and your main application must define WXUSINGDLL when compiling and link with the DLL import libraries. Otherwise you'd end up with 2 copies of the same static library in the same process, which can create many problems.
I was super excited to see that the latest previews of .NET Core 3.1 and Visual Studio 2019 add support for managed C++/CLI projects, as such a project is the only think keeping a particular project on .NET Framework.
So, I installed Visual Studio Preview 16.4.0 Preview 4, along with the "C++/CLI support for v142..." options, and as expected I see the new C++ CLR templates and have .NET Core 3.1 preview 2 installed
I created a new project using the "CLR Class Library (.NET Core)" template, copied the files an old managed C++/CLI project, tweaked a little, and the assembly built - great!
However, when I try to use the assembly in a .NET Core 3.1, I get this fatal exception:
Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'MyAssembly, Version=2019.0.1.0, Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format.
File name: 'MyAssembly, Version=2019.0.1.0, Culture=neutral, PublicKeyToken=null'
at TestApp.Program.Main(String[] args)
Both the managed assembly and test app target X64. Any ideas what could be the problem?
Someone from Microsoft provided the solution over on the Github repo.
When the managed C++/CLI project is built, a file ijwhost.dll is placed in the output folder alongside the assembly - this file needs to be deployed with the app that uses the assembly.
After putting ijwhost.dll in the same folder as the app, it worked as expected.
As an aside, the old C++/CLI project that I built against .NET Core 3.1 preview is actually quite complex - I'm very pleasantly surprised that it basically "just worked"!
Hopefully a better error message will be used in future!
I am using .net 5.0 as the CLI runtime. I finally found that the problem I have is missing native dependency DLLs.
For native applications, there will be an error prompt telling you which DLL is missing. While in .net core C++/CLI, they only give you a BadImageFormatException.
My solution is, create a pure native console project, paste the code that will cause BadImageFormatException, run it and see which DLL is missing then add it back to C++/CLI project file list.
I just found some unexpected dependencies.
In my case c# Net 5.0 app loads managed C++ dll, which is wrapping around unmanaged C++ dll.I get this error every time i try to run on on machine with no Visual Studio installed. I debugged it with ProcessMonitor and figure out that it can't found VCRUNTIME140D.dll. Found these dlls in my dev PC, copied them (both 32 and 64 bit versions) from my dev machine to customer's one to corresponded folders, and it made the trick. Hope will help somebody. Cheers.
I have made an application in c++, using FLTK 1.3.2 on Mac OSX and am happy with its functionality and now need to produce a Win32 version (a motivating reason for using FLTK)
I can get basic FLTK code to run on Windows now, but have come up against several issues:
1) Despite building my project as a release version whenever I launch the application is launches out of a command prompt. How do I stop this?
2) On Mac all resources can be included in the app bundle and then loaded as files from the app bundle path. Is seems that there is no equivalent in Windows; I have to include images (for instance) as a resource. The problem is that two distinct bits of functionality need a path to the image I want to use namely:
a) Fl_PNG_Image class where the syntax is Fl_PNG_Image a_guide("path/myfile.png");
b) SOIL image loader where the syntax is texture= SOIL_load_OGL_texture("path/myfile.png", SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS);
I want just a standalone application without the need to bundle folders with resources that need to be in the right place. How can I include files as a resource in Visual Studio and then use the with SOIL/Fl_PNG_Image and if not what else would people normally do in such a situation?
Thanks.
I have a simple C++ (non Qt Quick) application (that does not use .pro mechanism) built against the official Qt 5.4.2 x64 build (with openGL support).
As soon as I use the QWebEngineView object in my application, it fails to load with a message "Specified procedure could not be found".
With the help of gflags, it seems it fails to find the following demangled procedure:
public: __cdecl QOpenGLWidget::QOpenGLWidget(class QWidget * __ptr64,class QFlags<enum Qt::WindowType>) __ptr64
I am not sure to understand why this cannot be found, I have put for the sake of testing all the dlls in Qt_DIR\bin next to the application, and all the plug-ins.
The preprocessor list I use to build my app are as follow:
WIN32;_DEBUG;_WINDOWS;_USRDLL;WIN64;QT_WEBENGINEWIDGETS_LIB;QT_WEBENGINE_LIB;QT_QUICK_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_QML_LIB;QT_NETWORK_LIB;QT_UITOOLS_LIB;QT_CORE_LIB;WIN32PROJECT5_EXPORTS;PLUGIN_VENDOR_NAME="$(VendorName)";PLUGIN_VERSION="$(PluginVersion)";PLUGIN_NAME="$(PluginName)";%(PreprocessorDefinitions)
And the input libraries:
Qt5Cored.lib;Qt5Guid.lib;Qt5Widgetsd.lib;Qt5WebKitd.lib;Qt5WebKitWidgetsd.lib;Qt5WebEngineWidgetsd.lib;Qt5WebEngined.lib;Qt5OpenGLExtensionsd.lib;Qt5OpenGLd.lib;Qt5Networkd.lib;Qt5Xmld.lib;D:\NotBackedUp\Tools\Qt\5.4\msvc2013_64_opengl\lib\qtmaind.lib;shell32.lib;Qt5Quickd.lib;Qt5PrintSupportd.lib;Qt5Qmld.lib;Qt5UiToolsd.lib;glu32.lib;opengl32.lib;gdi32.lib;user32.lib;o2d.lib;%(AdditionalDependencies)
I wanted to try a simple example in Qt Creator 3.6.1 but it complains: Project ERROR: Unknown module(s) in QT: webenginewidgets
The browser.exe example runs fine (built with visual studio)
Do you have any idea of what is wrong?
PS: I am on windows 8.1.
For the procedure not found, my dll is a plug-in of a Qt application that is not built with opengl support. Only my dll is built with opengl support.
When initializing the plug-in, the application uses its own dlls rather the mine... and therefore fails to have any opengl support for the web engine.
For Qt Creator, it selected automatically a wrong kit. I had to create a new kit which maps to the correct Qt binaries (with opengl support): follow this: http://doc.qt.io/qtcreator/creator-configuring-projects.html.
Hope it will help someone