Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will not compile on Windows with MinGW #32

Open
LoganSchmalz opened this issue May 26, 2020 · 13 comments
Open

Will not compile on Windows with MinGW #32

LoganSchmalz opened this issue May 26, 2020 · 13 comments

Comments

@LoganSchmalz
Copy link

LoganSchmalz commented May 26, 2020

I needed the new version of the patcher to fix the "won't create patch with files that are 16mb" 1.31 bug (the link to download on the old issue seems to be down), but I absolutely cannot get the patcher to compile on Windows. MinGW reports that _wtoi, _wcsicmp, and _wcsdup are not declared in scope back from the define in flips.h. I've tried messing with the header unsuccessfully. I can confirm that it is compiling with the FLIPS_WINDOWS option (so these should be working), but I can't figure out much beyond that. I also can confirm that these functions are properly functioning on my computer in programs I wrote to test them quickly, including with #define.

@Sanaki
Copy link

Sanaki commented May 26, 2020

Read over #26 and see if that helps. Notably the final comment where I listed the working commands.

@Alcaro
Copy link
Owner

Alcaro commented May 26, 2020

mingw works for me, but there are many mingw variants.

Check if it works better if you add #include <string.h> and #include <stdlib.h> beside the #include <stdio.h> on line 63.

Alternatively, try deleting the three #defines on lines 67-69.

@LoganSchmalz
Copy link
Author

@Sanaki's suggestion worked, as well as setting up MinGW-w64 rather than the original MinGW.

Additionally, the original MinGW has a different definition for swprintf() due to Microsoft's old implementation that did not comply with the ISO-C standard, which means it still won't compile even using the alternative commands, so MinGW-w64 must be used (I was honestly unaware there was more than one MinGW variant, so hopefully this helps someone).

For whatever reason, I still cannot get it to compile via the makefile. Perhaps someone more experienced than I am can figure out how to make it work.

@Niilyx
Copy link

Niilyx commented May 23, 2021

Hi, I have the exact same problem and all the solutions proposed here and in #26 didn't work...

@Sanaki
Copy link

Sanaki commented May 23, 2021

You tried the commands in the final post there and it didn't work? What -did- happen?

@Niilyx
Copy link

Niilyx commented May 24, 2021

You tried the commands in the final post there and it didn't work? What -did- happen?

Yeah no, at first at tried to compile this stuff without the required libraries (I don't know crap about compiling stuff in C++). Then I tried a multitude of useless solutions, then the last commands in #26 and now I have my binary. Thank you for your help!

@13xforever
Copy link

Trying to compile on MSYS2 MINGW64 and getting

ld.exe: C:\msys64\tmp\ccNH0hGd.o:flips.cpp:(.text+0x83): multiple definition of `.weak.__cxa_pure_virtual._ZN4fileD2Ev'

@Alcaro
Copy link
Owner

Alcaro commented Feb 11, 2022

Isn't the point of weak symbols that they can be defined multiple times?

Maybe that specific one isn't as weak as it should be. Try removing line 14 from flips.cpp.

@13xforever
Copy link

Thanks, it works. I feel stupid, I just automatically scrolled to the actual code and didn't notice the extern definition

@bitrot-alpha
Copy link

On MSYS2 Mingw64:

/c/Users/me/work_mingw/Flips/flips-gtk.cpp: In function ‘int main(int, char**)’:
/c/Users/me/work_mingw/Flips/flips-gtk.cpp:1055:47: error: ‘F_OK’ was not declared in this scope
 1055 |         isFlatpak = (access("/.flatpak-info", F_OK) == 0);
      |                                               ^~~~
/c/Users/me/work_mingw/Flips/flips-gtk.cpp:1055:22: error: ‘access’ was not declared in this scope
 1055 |         isFlatpak = (access("/.flatpak-info", F_OK) == 0);
      |                      ^~~~~~
make: *** [Makefile:95: flips] Error 1

I tried manually defining FLIPS_WINDOWS in flips.h, but that just made matters worse. I will admit, my MSYS install might be borked.

@Alcaro
Copy link
Owner

Alcaro commented Aug 19, 2022

Either your msys installation is borked, or Flips is. And I already know Flips is borked in several ways, so let's assume there's only one bork going on.

Are you trying to compile with make.sh? That one is only intended for Linux binaries. If you want a Windows binary, you're supposed to use the Makefile, or grab the binary from SMW Central.

Though I will agree that error is quite unhelpful. I'd welcome a PR to either error out earlier or add Windows support to make.sh, but I don't have any msys on my machine (I compile my Windows binaries with a mingw installed in Wine, as seen in make-maintainer.sh), so I can't produce one myself.

@bitrot-alpha
Copy link

I tried using make which produced the above error. I also tried @Sanaki's solution, and that produced an exe, but when trying to run it outside of the msys terminal, it complains about missing mingw dlls. If I get some spare time, you may yet see a PR to fix whatever's wrong, or another follow-up with what my actual issue was.

@Miepee
Copy link
Contributor

Miepee commented May 30, 2024

e26220e should have fixed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants