Open a program in Wine, on Mac?

So I have a simple Hello World program written in c++, in Visual Studios '10 Express to be specific, and I was wonder how I can open in on my OS X? I Have tried wine, but the program closes immediately.

The program works perfectly on my Windows computer, I have found other articles with similar problems, but none of the suggested fixes works for me. I have tried both Debug and Release versions of the program, neither works. I can write the same program in Eclipse C++ on my Mac and it works fine, however, that is not how I want to do this.

Is there anyway to accomplish this using Wine or something similar?

Thank you.
Try installing the redistributable on Wine (you run the installer through Wine and this copies the relevant DLLs to the correct directories), or linking the program statically (Project properties > C/C++ > Code generation > Runtime library; select any of the options without "DLL" in the name).
Neither solution seems to do much good. I appreciate you trying to help, do you maybe have any other ideas?
Have you considered a full VM solution? It's gross overkill for your current situation, also legally speaking it requires you to buy a Windows license. But if you plan on taking this any further then it's almost necessary.

Just to be clear here, you're running the "Hello World" binary from within a persistent command prompt environment in Wine right? I want to make sure that this isn't a "Why is my console window closing down?" issue.
I have not, the Mac is actually a school computer, and the program I will be making, after I get the "Hello World" binary to work, is actually a simple Memory Text Game (EDIT: The game is for my Psychology class).

As for the persistent command prompt environment, if you mean the program keeps itself open while waiting for the user to input something or close the window, then yes. If that is something in Wine I need to check, then most likely not.

This is not "Why is my console window closing down?" issue. The program runs perfectly on my Windows computer.

Just in-case it could be any help what so ever, this is my code:
1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include <string>

int main()
{
    std::string a;
    std::cout << "Hello World." << std::endl;
    std::cin >> a;
    return 0;
}


Note: I do realize I can use cin.get();
I just didn't.

EDIT 2: Copy pasting the above code into Eclipse C++ using XCode on my Mac works perfect, however as stated before I would like to avoid doing it this way due to limitations in Terminal.
Last edited on
... the Mac is actually a school computer ...

So then you didn't actually try the solution that helios put up because you can't for a lack of permissions. You see little details like this one matter A LOT when we're trying to provide a solution to something like this.

My suggestion in this case would be to switch to an IDE that supports a consistent interface and a compiler for both a POSIX and Windows environment. Code::Blocks comes to mind since it's free, has both a Windows and a Mac version and comes with instructions on how to make it portable that can be found here: http://wiki.codeblocks.org/index.php?title=FAQ-Settings#Q:_Where_does_C::B.27s_configuration_file_store.3F_How_do_I_make_Code::Blocks_portable.3F

For trivial applications like this portability of the code should not be a problem. You'll still need to recompile it in a new project for each platform you are targeting though. I REALLY hope that the images between the workstations in your computer lab are homogeneous otherwise you're in for some frustration.
Well, hold on now, I never said I didn't have permissions, the student accounts are admin accounts. Unlike most schools, we are allowed to download and install things, I did try the solution helios suggested. The problem with me installing a VM is that they are very resource needy, where this Mac can barely run itself. Aside from that, assuming I can get it to run a VM, I need to get this to other students computers so they can play the game.

I actually had a similar idea, I thought that possibly it is VS2010's doing that is not allowing Wine to run it. So I have been downloading Code Blocks during this conversation, I was hoping we could come up with something easier using my already installed software. If we can't, I will report back about how Code Blocks works, for now, I have a 15 minute download on each machine ahead of me.

I have not read the supplied link, I am doing that as soon as I am done typing this; however, based on this statement:

You'll still need to recompile it in a new project for each platform you are targeting though.


I'm assuming it will run in Terminal on the Mac, which again, I do not want. Instead, I was looking for more of what Wine spits out if you feed it a .Bat file, which I was initially going to use to write the game, but decided to do it in C++ because of limitations.
Last edited on
... the student accounts are admin accounts.
... we are aloud to download and install things, ...
... this Mac can barely run itself.
... we are aloud to download and install things, ...
... the student accounts are admin accounts.

I want you to know that I will likely spend the next ten or so minutes curled up on the floor repeating to myself that correlation does not imply causation. I still want to help, but if you don't hear from me for a while it's just because I need to get over the idea of your last post.

By the way, yes, it would be running in a terminal on the Mac. That is because it is a terminal application.
I apologize, I don't understand why you are confused/upset/whatever-you-are-feeling, but I apologize.

Please, take ten minutes, then come back. Lunch break.

Running it in terminal is precisely part of the problem.
Don't apologize, it was supposed to be a joke. I have a dry sense of humor. I'm a Sys Admin and it's a rule among those of us in this profession that end users do not get admin rights to machines that we are responsible for managing, ever. The scenario you presented here can be described as comically terrifying from that perspective in addition to being completely unexpected.

By the way, why is running you app in a terminal a problem?
Last edited on
Ahh, I see, it is terrifying to allow hundreds of highschoolers/middle schoolers unrestricted access to computers....

I will take screenshots to better explain, it is really a personal dislike for the way it looks and how it handles stuff:

[IMG]http://i59.tinypic.com/5vbudw.png[/IMG]

As seen in the image, it has the traditional background and text color of a Windows Cpp Console app, the desired look. Also I noticed that at the top it is showing that it is being run in CMD, which is good and all, but what can I install for it to work the same way for a cpp program? Anyways, just an idea.

[IMG]http://i58.tinypic.com/2i6yow9.png[/IMG]

Here you can see it is in Terminal, which looks bad and I can't figure out how to get the extra text around it to go away, which honestly I haven't looked much into it, because I prefer the other look.

So just personal preference.
A command shell in Windows has the same kind of stuff around it. I suppose you could launch your process in a shell of it's own and clear the screen before displaying, or maybe allocate and display your own console buffer when it launches, just make sure you don't clear the screen buffer in the same console window that called like telnet does, that can get annoying. This is simple enough to do on Windows but I'm a bit out of my element on POSIX tbh.
Last edited on
I can't say any of my programs written in c++ have ever display similar things in the output...

I am not a huge Mac fan, in-fact if I could I would buy my school enough Windows computers for everyone, aside from that, I don't know much about Mac's, how can I make my own shell, why can't I just clear the screen before hand in my code... how would I go about that?
Topic archived. No new replies allowed.