is there any Binary Decision diagram (BDD) is available in windows.i tried to run cudd in vc++6.0..which is mention link
http://web.cecs.pdx.edu/~alanmi/research/soft/softPorts.htm
but it isn't working properly.i get compiler error while running a sample code
I compiled CUDD for Windows, but using MinGW not a Microsoft environment. My goal was that compiler since I use Dev-C as IDE.
I did a first try using Cygwin, but with no luck. The second try was with MSYS, an environment to run unix commands that come with MinGW for Windows. Note that CUDD uses a couple of POSIX libraries (such as ). Luckily they are used only in two secondary functions: CPU stats and a kind of fork that I didn't fully understood. Since I didn't need those, I simply commented the portion of code (in util/cpu_stats.c).
Then you only need to write a Makefile for MinGW in order to link the library!
If you need it, I can send to you the library already compiled.
Related
I have made a small c++ program using glfw, glut and dearImgui on linux machine. As i know, i have written this program so it should build on windows as well.
I would like to send this program to my friend who's running windows and doesn't have a compiler. How is it possible to build a program on a computer without a compiler?
Yes, you can make an installer for your c++ project that should allow your someone on windows to simply install and run it. There are multiple options for doing this but the first way that comes to mind for me is using cmake with cpack, but that would take learning how to use both, which, if you plan on continuing to use c++, is probably worth the effort in the long run.
Short term though, if you want to quickly send your project to your friend in a way he can run it, you can install a cross compiler for windows on your linux machine and just send him a compiled version for windows. Again, there are multiple options but I'm pretty certain MinGW should work for what you need, and be much simpler to learn quickly than cmake with cpack.
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.
For a few years I was writing programs in Visual Studio for Windows and with GCC (Code Blocks) for Linux. Most of my libs compiled seamlessly as they worked both in Windows and Linux. However at the moment I am a bit confused, as I have to create an app using Cygwin. I don't really understand if I am still in UNIX/Linux environment, just running app on Windows by some "emulation", or I am rather on Windows just having access to some Linux/Unix functionality. From what I understood from the FAQ's and documentation it looks like I just should behave like in Linux environment.
All explanations I found in internet usually are very general and don't explain the detailed differences from programmers viewpoint.
Short question: Can I just write programs like I did for Linux without any major changes when using Cygwin?
Maybe.
A lot of code written for Linux will compile in Cygwin with very few problems, which can mainly be fixed by messing with preprocessor definitions.
However, any code written for linux which:
Uses a Linux driver
Directly accesses the kernel
Relies on any code which does either of these two things (and doesn't have a Windows counterpart)
will quite definitely not work, regardless of how much you modify the code.
Much as it tries to, Cygwin cannot fully emulate (yes it is an emulator, of sorts) everything a POSIX system can normally do. Cygwin is not windows, just a conversion layer from its own machine language.
For more information, read cygwin's wikia
Can I just write programs like I did for Linux without any major
changes when using Cygwin?
The platforms are not identical, so you can not realistically expect to write the program in Linux, and then POOF expect it to build and work under Cygwin. But if you don't use things not available under Windows, then you won't need major changes. And you can write non-trivial programs, which will build and work on both, perhaps needing a few #ifdefs in places.
From your question I take it you want to work on Linux, but write programs for running under Cygwin. In that case you must also build and test it in the Cygwin environment all the time, so:
Use version control, commit often. I recommend a DVCS like git or mercurial which have separate commit and push, it will allow you to do commits more freely.
Whenever you commit/push, do checkout/pull and build on the Cygwin host. You can do this manually or automatically (by simple custom script polling the version control, or by Jenkins or something).
When ever your code stops building or working under Cygwin, fix it before continuing with new code.
If Cygwin is not absolute requirement, then I would look into using Qt SDK. It can be used for non-Qt projects too, the MinGW toolchain on Windows is very similar to gcc on Linux. And if you're willing to use Qt, then it has all sorts of platform-independent features for things you might want to do, such as discover locations of standard directories for saving files, use threads, print things, have GUI...
I'm a whiz with Visual C++, but Linux development is new to me. In Visual Studio, it's easy to trace into any code implemented by the C run time libraries. I just need to make sure the sources are installed and I can step right into any function I'd like -- malloc(), cout::operator<<(), whatever.
I'm trying to develop using Eclipse's C++ package. How can I step into C run time routines there? Since Linux is open-source, how do I step into operating system routines? Seems like it should e possible -- am I missing debug information, source code, or both? Something in my configuration?
I'm using Ubuntu 12.10 at the moment. I'm using g++. I believe I'm using the Eclipse build system as I never imported a makefile project; I just started with a simple "Hello World" project from the C++ project wizard in Eclipse.
After hacking at this a bit:
I've installed the libstdc++6-4.2-dbg package thinking it would be debug symbols for the libstdc library:
sudo apt-get install libstdc++6-4.2-dbg
I've also installed dpkg-dev, since the next step said I needed it:
sudo apt-get install dpkg-dev
I tried installing libc6 sources into a directory under my home:
apt-get source libc6
At this point, trying to step into printf() tells me that printf.c is missing. I can't step into malloc or strlen, which suggests that I don't understand how the C runtime libraries are factored in Linux. How are libc, glib, and libstdc++ different? Which packages do I need?
If I ask Eclipse to open the printf.c file I do have (at ~/eglibc-2.15/stdio-common/printf.c), it doesn't open the file (doesn't adjust the debugging window to show the source) and repaints the window that shows the error message about not being able to find the file. (Can't find a source file at "printf.c" Locate the file or edit the source lookup path to include its location.)
Whilst, as a Kernel developer on Linux, I do agree that using the individual tools separately will be a good thing to learn, and as such Basile's answer is usefuel.
However, the stepping into C runtime libraries should be equally possible with Eclipse. But just because the OS is open source doesn't mean that it supports you clambering around inside it willy nilly - in fact, you CAN NOT step into the OS itself from user-mode code. You nee KGDB (google it), and you definitely need a second computer to attach to the one being debugged, because when you step into the kernel, you will essentially lock up the machine, at the very least in the context you are stepping, but most likely also prevent other work from being done until you get back out from the kernel, so for example, if you step into open(), at some point the entire filesystem may well stop working altogether until you are back out of whatever lock you are holding. This wll certainly upset some software. Note that this is just an example of how things may work unexpectedly when debugging the kernel, not strictly "I've done this and it happened" - I have debugged kernels with debuggers several times, and you do have to be careful with what you do, and you certainly can not run the debugger on the same machine, as the machine STOPS when you are debugging.
Going back to the usermode, which you CAN debug via Eclipse, essentially all you need to do is install the source code for the runtime library you are interested in, and go... Same principle as on Windows with visual studio - except that nearly all software you ever run on a Linux system is available as source code. You may need to recompile some libraries with debugging symbols, and just like in Windows, you need to make sure the debugger knows how to find the source code. Everything else should be handled by the debugger in Eclipse. I spent about three years using Eclipse for both local and remote debugging, and in general, it works. There are quirks in places, but that's the case with almost any debugger.
Good luck.
First, you don't need Eclipse to develop software on Linux. You should better learn to do that with independent tools (command line) like emacs or gedit (as editor), git (version control), make (builder) which runs the gcc or g++ compiler (both gcc & g++ are part of GCC, the Gnu Compiler Collection).
really, you'll learn a lot more by not depending upon Eclipse; it may just hide you the real commands which are doing the job, and you should understand what they really are.
You want to pass the -g -Wall options to GCC. The -g option asks for debug information, and the -Wall options asks for almost all warnings. Improve your code till no warnings are given.
And the operating system is providing syscalls (which are operations provided by the kernel to applications; from the application's point of view, a syscall is atomic so you cannot step into it; however strace may show you all the syscalls done by some execution). If you wanted to step by step inside system libraries like libc you need the debugging variant of it (e.g. some libc6-dbg package). But there is usually no need to dive inside system libraries.
See http://advancedlinuxprogramming.com/
Then, you will use gdb to debug the binary program.
So, step by step instructions inside a terminal:
edit your source files with emacs or gedit
learn how to use GCC: for a single source C++ program compile it with g++ -Wall -g source.cc -o progbin and type ./progbin in your terminal to run it. Only when the program is debugged and satisfactory would you compile it with optimizations (by giving the -O or -O2 flag to gcc or g++)
Use gdb to debug a program (compiled with -g).
for a multi-file C++ program, consider learning how to use make
use a version control system like git
For beginners, I suggest to avoid Eclipse, because it just hides to you what is really happening underneath (Eclipse is simply running other tools like the above commands)
Software development under Linux requires a different mindset than under Windows: you really are using your own loose combination of independent tools, so better to learn a bit each of them.
NB. to step inside "system" functions like malloc (which is above syscalls like mmap) you need the debug variant of the libc package with aptitude install libc6-dbg, and you need to set LD_LIBRARY_PATH to /usr/lib/debug etc...
More out of interest than anything else, but can you compile a DirectX app under linux?
Obviously there's no official SDK, but I was thinking it might be possible with wine.
Presumably wine has an implementation of the DirectX interface in order to run games? Is it possible to link against that? (edit: This is called winelib)
Failing that, maybe a mingw cross compiler with the app running under wine.
Half answered my own question here, but wondered if anyone had heard of anything like this being done?
I've had some luck with this. I've managed to compile this simple Direct3D example.
I used winelib for this (wine-dev package on Ubuntu). Thanks to alastair for pointing me to winelib.
I modified the source slightly to convert the wchars to chars (1 on line 52, 2 on line 55, by removing the L before the string literals). There may be a way around this, but this got it up and running.
I then compiled the source with the following:
wineg++ -ld3d9 -ld3dx9 triangle.cpp
This generates an a.out.exe.so binary, as well as an a.out script to run it under wine.
If this is not about porting but creating, you should really consider OpenGL as this API is as powerful as DirectX and much easier to port to Mac or Linux.
I don't know your requirements so better mention it.
You can't link against wine as it's essentially a call interdictor/translator rather than a set of libraries you can hook into. If linux is important go OpenGL/SDL/OpenAL.
I believe(I've never tried this) you can can compile Linux binarys against winelib. So it works just like a Linux executable, but with the windows libraries.
http://www.winehq.org/site/docs/winelib-guide/index
go to the directory with the source and type in:
winemaker --lower-uppercase -icomdlg32 -ishell32 -ishlwapi -iuser32 -igdi32 -iadvapi32 -ld3d9 .
make
wine yourexecutable.exe.so
If you get this Error:
main.c:95:5: error: ‘struct IDirect3D9’ has no member named ‘CreateDevice’
make sure you have named your file main.cpp and not main.c.
There is currently no way to compile DirectX code to directly target Linux. You would build your application like you normally would, then run it using a compatibility layer like Wine/Cedega.
you can compile a directx apps in linux, but not launching it straight away.
if you use a crosscompilator that makes windows exe and point to the windows sdk and directx sdk.
Although this question is dated, I decided to updated on it, because it keeps popping up for me as the first suggestion for this particular problem.
As the previous answers already suggested you can compile against winelib. However, there are yet another two solutions.
The first solution would be either to use the MinGW provided for your distributions. MinGW is a 'cross-compiler', that compiles either from macOS or linux to windows and has support for DirectX. Note, that C++ libraries compiled with MinGW are not compatible with the MSVC compiler's ABI, thus cannot be consumed. However, the resulting binaries can be executed using Wine.
The second solution would be to use clang as a cross compiler. Clang usually includes the Compiler and Linker needed for Windows out of the box. However, it'll require you to include provide the headers and libraries yourself. On the other hand, libraries compiled this way are compatible with MSVC and, thus, can be consumed by it.
Side note:
Latter allows you to setup an CI server using linux (I did so on a raspberry pi), which creates compatible binaries for end users.
Wine is the only way to run DirectX in Linux