How do I compile peercoin to generate windows binaries? - c++

I have been trying to compile peercoin (https://github.com/ppcoin/ppcoin) for windows and have failed so far.
The Linux one compiles on Ubuntu perfectly and most forums suggest using the compiler on Linux to generate windows binaries. I have never heard or using linux compiler to generate windows binaries.
So the question is : How do I compile the peercoin source for generating windows binaries?
Thanks
Edit: I tried the ming libraries as mentioned in the makefile but there are multiple compile time errors including non-descript errors like "unable to find matching '" etc.
Bounty for step by step explanation for generating the windows binaries (on Unix or Windows)

Found the answer. The problem is that paths for mingw cannot end in "\" apparently. So my paths "c:\mingw-32" is perfectly fine but "c:\mingw-32\" throws an unable to find matching quotes error.

Related

How do I link a library in VSCode?

I'm trying to include curses.h and some functions from that lib (specifically detecting a keyboard hit without stopping), but whenever I try, it gives the error "symbols not found." I'm assuming that this is because the clang++ compiler sees curses.h as a C library. I've gathered I need to link curses.h, but I don't know how and I could not find any real guides.
I'm writing a program in C++ using VSCode and clang++ on a mac. Any help is appreciated.
For anyone else who has this problem- my clang version was outdated. It was installed, so after a brief check, I thought all was good. However, it was not able to compile (nor find some libs for some reason) the newer versions of C++. Installing the latest version of clang fixed all issues.

Converting a Linux Library Project into a Library Project usable in windows

I am attempting to convert the ndn library project found at "https://github.com/named-data/ndn-cpp" into something that can be imported into several existing mfc/wpf/forms Visual Studio Projects (building it as .lib or .dll would work).
As a note, it appears to have previously been converted into c# for windows for a older build of ndn, but is no long supported and will not connect with the current ndn network.(https://github.com/named-data/ndn-dot-net)
I have looked into the using the WSL features that they have added to windows 10, and the Visual studio Linux Cross Platform projects, but these all seem to only be able to make .exes that will run in windows not a .lib or .dll that can be imported into another project.
I have also look into the shared items project but what I was able to find didn't seem like it would work for what I'm trying to do.
Lastly, I tried using cygwin. I was able to compile and generate the linux style libraries(.a) on my windows 10 machine, but when i attempted to generate windows style dlls off the .o files(gcc -shared -o mydll.dll mydll.o) I ran into a large number of reference errors that I was unable to resolve.
Does anyone have any recommendations on which of these methods I should be using or if I should be attempting some other method entirely?
Does anyone have any good references or examples of how to do this for someone with limited Linux experience?
Thanks
Ok. I've tried going about this several ways now, and here's what I've learned that might be useful to someone else trying to do this and also where I stand so far:
If you have a simple Linux dll that you have written it's possible to compile it as a Windows dll using MSYS2 or MINGW, instructions are here: http://www.mingw.org/wiki/MSVC_and_MinGW_DLLs
If you have something a bit more complicated like the program I'm trying to convert above, there is no quick fix to convert from Linux to windows, however you still might be able to compile your program for windows using Visual Studio.
Here's how you do it:
Download vcpkg from https://github.com/microsoft/vcpkg This is a linux package manager for windows, it will allow you to download windows equivalents to many common Linux packages (for the above I had to download boost and sqlite3)
Create your own unistd.h, here's a link to that: Is there a replacement for unistd.h for Windows (Visual C)?
Get dirent.h for windows, here's a link to that: https://github.com/tronkko/dirent
replace instances of gmtime with _mkgmtime or redefine gmtime as _mkgmtime: timegm cross platform
This got me about 90% of the way there (and from about 13,000 compiler errors to about 30), The rest of the errors so far have been for calls where there is no easy linux to windows conversion and those sections of code have had to be re-written. (In the code above this would be the socket code for the tcp/udp connections in the tranport files, Linux and Windows handle it pretty differently, boost does have a good guide for how to use it's sockets in windows though: https://www.boost.org/doc/libs/1_60_0/more/getting_started/windows.html)
So that's it. Hopefully this helps someone else down the line. I'll be adding more to this answer as I discover new things.

Compile A MSVC++2010 Project So It Can Run On Ubuntu

I have a MSVC++ 2010 project. All the libraries it's using are cross platform (SDL, OpenGL and FLTK).
Obviously, all I have to do right now is press the debug button and it will compile a nice old .exe for me which can now run on Windows, as long as the DLL files are with it.
I had thought before that if you use cross platform libraries, then the generated .exe would run fine on Ubuntu too. I recently found out that this is not possible, and that the program must be compiled in a special way to run on a certain platform.
Is it possible to compile my project in this magical way with MSVC++ 2010 so that it can run on a Ubuntu computer? If so, then could you please answer my question with some clear steps as to what I should do to compile it this way, keeping in mind I'm new to how all this cross platform stuff works?
EDIT:
If I cannot compile a MSVC++ 2010 project for Ubuntu, is there an IDE I could use that could compile the project for both Windows and Ubuntu?
Thanks.
I suggest you use QT. http://qt.digia.com/
It's probably the best cross platform IDE that can let you compile for Windows, Mac and Linux(ubuntu) systems.
Nope, not possible. While the binary code corresponding to the program can be portable, that's not enough. Executable formats on various file systems are different and not compatible. The executable format is essentially a packaging of the binary data and wrapping it with a header that the target file system understands. In order to produce executables for Ubuntu, the linker must support it. MSVC++ doesn't support Linux formats.

How to compile a .cpp file into a Windows executable (.exe) file in Linux

I make this program in C++ using Code::Blocks on Ubuntu. I need to turn it into a Windows executable binary (.exe file), but I don't know how to do this. Is it possible?
If you meant, compiling an executable for Windows on Linux you might find some pointers on how to do that here.
Both the MinGW32 distribution of GCC and Wine should be available for your distribution.
MinGW has instructions and winegcc wraps a similar compiler that comes with the Wine distribution.
I've used both to compile both applications and libraries for Windows.
You could read here on how to compile wxWidget applications on Linux for Windows using Code::Blocks.
This is a fairly unusual question. What you're asking is that you want to develop on Ubuntu, but the target platform is Windows?
My guess is that you have an assignment to turn in. My belief is that you should go to a lab and compile it and make sure it's working.
However, doing some research, you should try mingw at http://www.mingw.org/

Where can I find the binaries for arm-wince-pe-gcc?

I am looking for a version of the gcc (C++) compiler targeting the ARM uP and WindowsCE operating system. Thus far I have only been able to locate compilers which either target the ARM uP but produce ELF executables (GNUARM etc) or they do target windows CE but have not been updated since 2003. I believe the exact name of the compiler I am looking for is arm-wince-pe-gcc as mentioned In the GCC documentation but I have no clue how to get hold of a binary. Any/all help will be greatly appreciated.
I'm using CEGCC from SourceForce: http://cegcc.sourceforge.net/, and so far it works OK. I've managed to build a Windows API application, zlib and libpng, and everything runs just fine on Windows CE 5.0, and the C code you write is the same one you'd write in Visual Studio.
Use the mingw32ce toolchain from there. Build the toolchain yourself, from the latest SVN sources.
I use this under Linux, but it should work under Cygwin as well I'm guessing.
Build one yourself. GCC is well set up to produce cross-compilers, see the build instructions.
I found a binary version of the required compiler here: http://sourceforge.net/project/showfiles.php?group_id=173455&package_id=198682 choose
0.51.0/cygwin-cegcc-cegcc-0.51.0-1.tar.gz file for download.