I've been looking to build wxWidgets app with MinGW:
Compiling a wxWidgets application with MinGW from prompt under Windows XP
After successfully building the executables with demo code in wxWidgets document, I put them together with the directory where the DDL release files I downloaded on their site.
But after running that executable file, the following error is displayed:
main.exe - Entry Point Not Found
The procedure entry point ZNSt15basic_streambuflcSt11char_traitsIcEE7seekposESt4fpo sliESt13_los_Openmode could not be located in the dynamic link library D:\CODE\C++\wxWidgets\TEST\src\wxmsw32u_core_gcc1210 x64.dll.
My MinGW contains gcc and g++ version 12.1.0, wxWidgets library I download Windows Binaries MSYS2 MinGW-w64 12.1
I successfully compile with the command:
g++ main.cpp -o main.exe -l wxbase32u -l wxmsw32u_core
Related
I am trying to cross-compile Windows software on Linux using mingw32-w64 and running it with wine. However wine cannot load the libstdc++-6.dll library file. I searched online and found out that you have to put the directory that contains the DLL file into the path registry. In my case, that directory is Z:\bin\i686-w64-mingw32\bin.
Then I tried to run the compiled file by using wine executable.exe and the output is:
0100:err:module:import_dll Loading library libstdc++-6.dll (which is needed by L"Z:\\home\\sunnymonster\\dev\\c++\\opengl-tests\\cmake-build-debug\\opengl_tests.exe") failed (error c000007b).
0100:err:module:LdrInitializeThunk Importing dlls for L"Z:\\home\\sunnymonster\\dev\\c++\\opengl-tests\\cmake-build-debug\\opengl_tests.exe" failed, status c0000135
I have verified that I am using the correct wine prefix.
Additional information:
Linux distro: Manjaro Linux 21.2.5
Linux kernel: 5.16.14-1
There're multiple approaches. First, let's formalize the problem:
$ cat test.cpp
#include <iostream>
int main() { std::cout << "hello" << std::endl; }
$ i686-w64-mingw32-g++ test.cpp -o a && WINEDEBUG=-all,err+module wine ./a.exe
0024:err:module:import_dll Library libgcc_s_dw2-1.dll (which is needed by L"Z:\\tmp\\a.exe") not found
0024:err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\tmp\\a.exe") not found
0024:err:module:LdrInitializeThunk Importing dlls for L"Z:\\tmp\\a.exe" failed, status c0000135
Solutions:
Link the core libraries statically:
$ i686-w64-mingw32-g++ test.cpp -o a -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
$ WINEDEBUG=-all,err+module wine ./a.exe
hello
Use WINEPATH env. variable to tell wine the additional paths to load dlls from. In the example I pass it the location with mingw dlls that wine complains about. It may be different on your system, you might find it by asking package manager to list files in mingw-g++/gcc packages (whatever it's called on your system). Multiple paths should be separated by semicolon.
$ i686-w64-mingw32-g++ test.cpp -o a
$ WINEDEBUG=-all,err+module WINEPATH=/usr/i686-w64-mingw32/sys-root/mingw/bin/ wine ./a.exe
hello
Install a Windows version of MinGW, and then use it to compile the app. However, from what I remember, if you want to distribute the executable produced, you still need to either statically link against MinGW libs, or provide them together with the binary. So the only difference to point 1 is that the binary should work under your WINEPREFIX with no modifications.
Using wineg++. I mention it solely for completeness, I think it's the least useful solution. It produces a Linux file, which in itself might be okay, one could use that for debugging. However, in my tests, I didn't manage to makewineg++ link against a dll, even though mingw links to the same dll without a problem. It seems to link against .so files instead, even though the application you build with it can load .dll files dynamically. Odd utility.
$ wineg++ test.cpp -o a
$ WINEDEBUG=-all,err+module wine ./a.exe
hello
Im currently trying to compile a cpp program with gcc that uses SDL2 library, and im using Ubuntu 20.04 LTS. Here is my folder structure
project
-out
-SDL2
-src
-main.cpp
Excluding the library i have uploaded everything to this repo https://github.com/probottpric/libtest if it gives a better understanding.
To install SDL2, I installed source code and ran ./configure and make all. I dont want to run make install which installs it on /usr/*. I want the library to be on the local folder.
To compile program im using this command
gcc -o ./out/main ./src/main.cpp -ISDL2 -lSDL2 -lSDL2main -lm -std=c++11
But It shows library not found error. What am i doing wrong ?
So I want to use tesseract api on my project.
And the problem is I don't know how to compile this baseapi.h with MinGW on window.
I'm using this
g++ -I/[...]/project/tesseract-master/include/ -I/[...]/project/leptonica/src/ t.cpp -o t
and got
In file included from t.cpp:2:
/[...]/project/tesseract-master/include/tesseract/baseapi.h:33:10: fatal error: tesseract/version.h: No such file or directory
#include <tesseract/version.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
I think the problem is about version.h file, It's actually a version.h.in file
leptonica also have same problem with .h.in file
I don't know if MinGW can compile this type of file, so if there's a way or it can't pls tell me thanks.
g++.exe (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0
Tesseract from main branch https://github.com/tesseract-ocr/tesseract
Leptonica from 1.80.0 release
https://github.com/DanBloomberg/leptonica
It seems that you did not install tesseract - otherwise version.h (actually generated during tesseract build/compilation) would be present.
On my raspberry pi I am using c++ to write a web project. I am following C++ CGI. I installed gnu's cgi library using apt-get installed libcgicc3. When I compile the form g++ -o cform.cgi cform.cpp i am getting the following error. Fatal error cgicc/CgiDefs.h no such file. How do I find the cgi library. I have seen an example of the compile g++ -o file.cgi file.cpp /usr/libcgicc.a that doesn't work for me. libcgicc.a is not in that directory. Where can I find the file to compile the application.
You're almost there. You need to install the libcgicc-dev package instead, that containers header files and the library to link to.
To link with the library (called libcgicc.so):
g++ -o file.cgi file.cpp -lcgicc
I am trying to deliver a Windows DLL (as well as a .so) from a Linux box using Mingw.
I am following this example, which consists of three files, the DLL source example_dll.cpp, header example_dll.h, and a client application example_exe.cpp. These I have located in a folder shared by my Linux host and Windows 7 VM. Both boxes have Mingw installed.
The build commands for the DLL are
g++ -c -DBUILDING_EXAMPLE_DLL example_dll.cpp
g++ -shared -o example_dll.dll example_dll.o -Wl,--out-implib,libexample_dll.a
and for the client app
g++ -c example_exe.cpp
g++ -o example_exe.exe example_exe.o -L. -lexample_dll
All compiles and runs perfectly on a Windows 7 VM with Mingw installed.
All compiles perfectly under Ubuntu 16.04 with Mingw installed, replacing g++ with i686-w64-mingw32-g++.
But in this case, when the executable is run from the Windows VM, "The program can't start because libgcc_s_sjlj-1.dll is missing.
What mistake am I making?
I can force the "missing" DLLs into the executable, by replacing 4. with i686-w64-mingw32-g++ -o example_exe.exe example_exe.o -L. -lexample_dll -static-libgcc -static-libstdc++ on Linux, and that works perfectly on the Windows VM.
But I need to deliver a DLL, not an executable.
I have noticed that the DLL libgcc_s_sjlj-1.dll exists on the Linux box but not the Windows box.
I have also noticed that the Linux box has Mingw 5.3.1 while the Windows box has Mingw 6.3.0