LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-12-2004, 06:07 PM   #1
The Oate
Member
 
Registered: May 2004
Location: Massachusetts
Posts: 134

Rep: Reputation: 16
Question Problem with Executable Files


I wrote a relativly simple program in C++ in linux and the program runs fine. However, I emailed the .cpp file to my Windows comp and when I compile it in Visual Studio .NET, I get an .exe file that when I run it, it simply pops up a command prompt window for about a second and then just closes it. I remember I used to have this problem a long time ago when I programmed in Windows, but I don't remember what the fix for it is. Could someone please tell me how to get these windows to stay open so I can actually run my programs?
 
Old 08-12-2004, 06:10 PM   #2
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
toss in a getchar() at the end so it waits for user input. or run the program from an actual DOS prompt.
 
Old 08-12-2004, 06:15 PM   #3
nalg0rath
Member
 
Registered: Feb 2004
Location: Stockholm, Sweden.
Distribution: Gentoo Linux
Posts: 30

Rep: Reputation: 15
Or you can add a line at the at the end of the main function that looks like this:
Code:
system("PAUSE");
 
Old 08-12-2004, 07:13 PM   #4
The Oate
Member
 
Registered: May 2004
Location: Massachusetts
Posts: 134

Original Poster
Rep: Reputation: 16
Quote:
Originally posted by nalg0rath
Or you can add a line at the at the end of the main function that looks like this:
Code:
system("PAUSE");
Worked to perfection. Thanks a lot for the help, but I have another question. I was getting errors when I tried to compile because I was using cin to read in a string and I hadn't included the string header file. This makes sense of course, but why didn't I get any errors when I was compiling with gcc. I didn't change a thing about the program when I copied it over other than the pause added. Shouldn't I have received this same error or at least a warning from gcc?
 
Old 08-12-2004, 09:26 PM   #5
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
gcc links to some libs by default, i'm guessing string is one of them.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
java executable files vong'xion Linux - Newbie 3 10-06-2005 08:27 AM
edit executable files jonathanjumbo Linux - Software 2 05-22-2005 02:22 PM
Cannot execute executable files without ./ brady9953 Linux - Newbie 3 10-13-2003 03:19 PM
Converting perl files to executable mac files mrozkan Programming 0 04-16-2002 09:56 AM
Executable Files Acar Linux - General 1 02-22-2002 10:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration