You are not logged in.

#1 2007-05-04 07:04:31

pecan
Member
Registered: 2007-04-06
Posts: 93

C++ compiled programs won't run in windows

I've been learning C++ for a week or two now, getting a good hang of it. I just use Kate as my editor and g++ to compile the program. It all runs fine under linux, but I'm not sure how to make a program to execute easily (terminal) in windows. So if the program runs in terminal on Linux should it run in a DOS window on windows? What do I need to do to allow my little apps to work properly under windows?

Offline

#2 2007-05-04 07:09:44

cyt
Member
From: Taipei, Taiwan
Registered: 2006-03-22
Posts: 18

Re: C++ compiled programs won't run in windows

pecan wrote:

I've been learning C++ for a week or two now, getting a good hang of it. I just use Kate as my editor and g++ to compile the program. It all runs fine under linux, but I'm not sure how to make a program to execute easily (terminal) in windows. So if the program runs in terminal on Linux should it run in a DOS window on windows? What do I need to do to allow my little apps to work properly under windows?

You have to recompile your source code under Windows.

Offline

#3 2007-05-04 07:24:28

pecan
Member
Registered: 2007-04-06
Posts: 93

Re: C++ compiled programs won't run in windows

big_smile Thanks for the help. You can tell I'm a complete beginner when it comes to programming.

Offline

#4 2007-05-04 08:33:02

lloeki
Member
From: France
Registered: 2007-02-20
Posts: 456
Website

Re: C++ compiled programs won't run in windows

depending on the app, you might want to take a look at cygwin, else you will hit many (mainly posix compliance, unix semantics, and api differences) porting issues that could be too much hassle if you're just beginning to learn. cygwin alleviates all that. I used it back in the day (before windows went through my window wink) for exactly the same purpose.

Last edited by lloeki (2007-05-04 08:35:23)


To know recursion, you must first know recursion.

Offline

#5 2007-05-04 08:50:08

PJ
Member
From: Sweden
Registered: 2005-10-11
Posts: 602

Re: C++ compiled programs won't run in windows

lloeki wrote:

depending on the app, you might want to take a look at cygwin

MinGW is another alternative.

Offline

#6 2007-05-04 10:53:35

STiAT
Member
From: Vienna, Austria
Registered: 2004-12-23
Posts: 606

Re: C++ compiled programs won't run in windows

I'd recommend you using MinGW as a compiler for windows when you used linux to program and test your sources.

Though, some calls, defines and includes are different in windows and linux, but you can check this by checking the compiler environment

#ifdef __WIN32__
...
#endif
#ifdef __LINUX__
...
#endif

also WINBUILD instead of __WIN32__ and LINUX instead of __LINUX__ should work properly.

// STi


Ability is nothing without opportunity.

Offline

Board footer

Powered by FluxBB