I am in a introductory c++ class and the teacher gave us a .exe from his visual studio code to show us what our program is supposed to look like. My question is can I run this on the command line. I have problems with wine and would rather not use it (i.e. wine xxx.exe). I have tried ./xxx.exe. All the questions I have seen deal with actual programs running a real game or something so I don't think this is a duplicate but if it is please point me to the correct place.
The binary format for linux and windows is different, so there must be a middleware that will know how to call a windows binary in linux, this currently is wine, if it's a console windows application it could also be dosbox.
You already said that you had problems with wine and prefered not to use it, sorry, you have to. executing a binary from windows in linux without wine is like trying to opening a wine bottle in linux, linux is not a bottle opener, not it's windows - binary format compatible.
Another thing you could ask for your teacher is the source code for his application, you could try to compile under ubuntu (if he used standard c++) and run there.
Related
I've been looking all over google for this but never got a clear answer..
I'm trying to write a simple hello world application and make it run under msdos (which I will be installing on a old rig lying around here).
But first things first, I've been trying to compile a normal console application and drop it in dosbox to test it out which doesn't work, just says it's invalid. So I assume I need something else to compile it with. Does this mean I'm obligated to build my code in a msdos environment? Even if this is the case, I have no clue at all how to do this, kinda a msdos dummy..
If anyone can shed some light on my case I would be very grateful!
P.S: I'm running a 64bit system
You can use the free DJGPP compiler for DOS. And here is the documentation for using DJGPP.
I'm assuming that you mean actual DOS and not a command prompt running in Windows.
DOS is a 16-bit OS, so you will need a compiler capable of generating a 16-bit binary. A Windows console application is 32-bit, so it won't run under DOS. You don't have to build your code in a DOS environment, you will just need the right compiler.
As for compilers, you might want to check out OpenWatcom.
Microsoft Visual C++ 1.52 is the only available version of a Microsoft
C++ compiler that supports compiling 16-bit code.
http://social.msdn.microsoft.com/forums/en-US/Vsexpressvc/thread/cfc848e8-a797-42a5-8537-892cfc234123
You need to find an old compiler that will generate 16bit COM files.
Could running it on a 64bit system be an issue?..
Yes, 64-bit Windows cannot execute a 16-bit program. If you install a virtual PC with MS-DOS or a 32-bit Windows system, the virtual PC will be able to execute a 16-bit program.
Do you need to edit your question to say that you're using 64-bit Windows?
It sounds like you are compiling a console app on a modern version of Windows and trying to simply copy it to an old DOS box. The problem is that DOS is not forwards compatible. You cannot run a program compiled with Windows 7 on pre-Windows versions of DOS. The simplest solution is to compile your programs on the DOS box itself. Alternatively, if you want to develop on a newer machine, you need to get a cross-compiler which targets the OS where you want to run your program.
I'm developing C++ apps for Linux, but my workstation is Windows 7. I've read that Visual Studio is the strongest C++ IDE for Windows, but I actually want to execute the code on Ubuntu and be able to use a more graphically pleasing debugger than gdb, although the functionality of gdb is pretty good. I'm really happy with valgrind as well, but again, I'd like to be able to leverage that in an IDE in windows.
I currently use QtCreator as my C++ IDE and I edit the files over a samba mount to the linux box. I use Putty to run the Linux commands. I use git as my source control system, gcc as my compiler and cmake as my build system. I like QtCreator, but as I have it configured, I'm not taking advantage of code-completion or debugging.
The closest thing I've seen is CodeWarrior. It allows for executing code on remote embedded systems and a full debugger. Has anyone ever used this for general app development on Ubuntu?
Is QtCreator the right IDE for me? Is there something else that I can do to configure it so that it'll give me those rich IDE features that I'm looking for? Or should I look to another IDE? Also, are there some tools that I've neglected to mention that would make C++ development easier on a Linux box from a Windows workstation?
Thanks in advance...
It is not clear, you run QtCreator on windows?
If so, you can run QtCreator in Linux,
plus install nxserver on Linux,
and nxclient on windows (http://www.nomachine.com/).
So you run nxclient on windows, login to linux,
and work on linux, in compare with virtual machines,
you get more prefomance.
Use VirtualBox and linux virtual machines?
X Windows.
You could install Cygwin to run an X11 server on your Windows 7 desktop, then run an X11 graphical IDE like QtCreator on your Linux server that renders directly to your Cygwin Windows 7 desktop. I actually tried setting this up with Code::Blocks on openSUSE and Cygwin on Windows 7 just a few weeks ago because I'm in the same situation you're in. It works... kind of. There are weird intermittent errors.
Your scenario is exactly the scenario that the X Windows system was designed for, and it is awesome in concept, but the actual X11 protocol design and implementation is, I gather, old and pretty hairy. I have very little experience with X, but the people who do have lots of experience with it seem to complain about it a lot, and I suppose there are good reasons for that. Too bad, because it would be wonderful if there were a technology like X Windows that worked. AJAX is basically a cheap hack for solving the same kind of problem that X Windows tried to solve... running a remote application with local rendering of a rich GUI.
I gave up on X and I still do the same thing you do: I have putty and Samba-mounted files that I edit with Visual Studio. Visual Studio is the best text editor I've ever used. All the other Visual Studio IDE features are gravy.
There's some solutions :
VmWare : not free but really good
Virtualbox : free but less powerfull than VmWare
KVM/Qemu : Free but less powerfull than VmWare
I copy the machine code of a function on Windows.
For example:
void func()
{
printf("hello");
}
In the above case, I would copy func()'s hex code segment data and printf()'s hex code data plus other dependencies and data and relinked it on a differnt machine running linux, would it be possible to run the code on a linux machine if properly relinked?
And if so would it there be a licensing problem? (Is it legal?)
P.S. The question regards to a distributed system question.
There is a wine program (and project) which is not an emulator. It will take exe file from windows and run it in the linux directly. Most used WinAPI will be translated to linux and to X11 graphic system.
If you want just to run exe files from windows under linux - this will be the answer. If you want know how to do this, you can read sources of Wine and/or documentation of wine and/or articles about wine and its design. Or ask authors of the wine in mailing list.
This is a pretty vague/unanswerable question, but this would be extremely difficult, if not impossible. You have a number of difficulties which would need addressed. Namely, the executable format (ELF on Linux, vs PE on windows), the calling conventions between systems/compilers, etc.
The biggest issue I can think of, is that the file handling between Linux and Windows is extremely different. Your best bet would not be to copy printf(), but to redirect that call to the windows implementation, because after all of the library function work, the low-level write to the console is very different.
Hi
I'm trying to compile quite a big linux program on Visual Studio. The source code is here
http://public.fh-wolfenbuettel.de/~hoeppnef/fc.html
I managed to overcome most problem however now I have no idea what to do. I got an error
Cannot open include file: 'ext/functional': No such file or directory
The problem is, that I can't find this header file, I've searched entire web and I could't find it. Is there any way to run compile this application on visual stuio ?
Or maybe You could recomend me good IDE on Linux (I've been always programming on Windows)
It would be great if IDE on Linux had debugger as convinient as Visual's debugger
Porting this whole is going to be non-trivial. For a start, there are portions of the code that run system commands using linux syntax. Specifically:
if (legend)
system("awk '/^###/ { if ($3>1) printf(\",\"); printf(\"\\\"-\\\" title \\\"%s\\\" with lines %d\",$2,$3) }' < .gsv-3.tmp >> .gsv-0.tmp");
else
system("awk '/^###/ { if ($3>1) printf(\",\"); printf(\"\\\"-\\\" notitle with lines %d\",$3) }' < .gsv-3.tmp >> .gsv-0.tmp");
That from the gnuplot driver.
I suspect you are not looking for a major porting job and just want to run the code and tweak things. That being the case, the easiest in terms of work until results will be to use it on Linux and get used to gdb. Other options include trying msys/cygwin as these provide a linux-like environment but on Windows. However, unless you really want to start re-writing large chunks of the code, the app won't work whole.
I should add at this point cross platform portability (and I mean cross Unix/NT, not just amongst unices) needs to be designed in very carefully from the start of an application's development.
There are two other suggestions which may take some effort to get working.
Pull out the pieces you need. This shouldn't be too difficult. Yes, you might need to re-write some of the logic/prune out some linux-only features, but it should be possible.
Eclipse is a good IDE for Linux that gives you C++ support. I've never tried it in terms of debugging as I tend to stick to gdb but for Java it is very good. Might be worth a shot.
Regarding the Linux IDE request; I've always used Code::Blocks & GDB under Linux and so far no problems at all.
I am trying to setup a development environment for Linux C++ application. Because I'm limited to my laptop (vista) which provides essential office applications, I want to program and access email, word at the same time.
I'd prefer a local Windows IDE. SSH to a company linux server and using VI doesn't seem productive to me. Even using some IDE installed on the linux server doesn't seem good to me, because I can't do the work at home.
So does Eclipse CDT + MinGW work for me, or is there any other choice?
Thanks.
ZXH
Why not install a Linux virtual machine on your laptop, in VMware or similar? That way you can test while you're developing too.
You can also try http://cygwin.com/
Is it a GUI app? And do you have to target Linux specifically? If not, Qt (http://trolltech.com/) may be something that you can use. It would allow you to more or less develop your whole application on Windows, and then spend a few hours on a linux machine getting the whole thing ported...
Qt is the best choice. I develop with tis tool for a long time. And you can develop with the same ide : QtCreator and the same framework : Qt on MacOS, Linux based or Windows plateform...
Moreover, specifically on Linux, Qt is well integrated with Kdevelop !
If you have Visual Studio, which I feel is an excellent IDE, you can try to set it up to use GCC/G++. I've done this before, back in the Visual Studio 6 days. As long as you aren't using any Windows-specific libraries and write portable C++, you can compile and test on Windows, then periodically ensure that the code also compiles properly for Linux.
Another approach, one that I actually prefer, is to host your source and make files on the Linux box, share the files through Samba, then use your Windows IDE/text editor to edit those files. Then, you can do the compiling through an SSH terminal. Sure, you'd lose the convenience of being able to compile through your IDE, but at least you wouldn't have to muck around getting the compiler set up on Windows.
If you have a linux server available to you, you could also use NX to log in graphically, and use a Linux IDE there like Code::Blocks, or shudder Eclipse. Of course, there's nothing unproductive about shelling in and using VIM. I find it's a good way to shake out the IDE-induced cobwebs every now and again. Happy coding however you end up doing so!
I use (and recommend) Netbeans for C/C++ Development together with Cygwin to develop POSIX applications on Windows that will run on Linux/Solaris later on.
It is pretty easy to setup as long as you stick to the stable version of Cygwin.
I was in a similar position 2-3 years ago and tried several approaches, but the only one that really worked wor me was vim+ssh (+gdb, make, svn, etc). But again, I use vim even for Windows development.
This slideshow (PDF) walks through how to set up a cross compiler from Windows to Linux.