943,720 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 6368
  • C++ RSS
Mar 26th, 2005
1

Command-line Arguments.

Expand Post »
Hi,
I'm using MS visual studio 6 for a C++ program. I am able to run the program from IDE, but when I've attempted to run it from the command line, I get a message the program name is unrecognizable. I've included the following code:

C++ Syntax (Toggle Plain Text)
  1. int main(int argc, char *argv[])

But I've noticed that after building the project I don't have an .exe in the workspace.
My question is: are there any project or workspace configuration steps that I must follow in order to get the .exe file? or what could it be that I'm doing wrong?

Thank you all in advance.
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Layla_2401 is offline Offline
22 posts
since Sep 2004
Mar 26th, 2005
0

Re: Command-line Arguments.

>But I've noticed that after building the project I don't have an .exe in the workspace.
Look in the Debug folder.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 26th, 2005
1

Re: Command-line Arguments.

When you created this project you may have inadvertantly selected of the 15 choices the wrong type. In your case Win32 Console Application would have been the one you wanted. There are also several other settings that could have been corrupted, so the simplest thing to do is create a new console project, attach your headers and source files and re-build.
Reputation Points: 47
Solved Threads: 17
Posting Whiz in Training
Tight_Coder_Ex is offline Offline
215 posts
since Feb 2005
Mar 27th, 2005
0

Re: Command-line Arguments.

Narue & Tight Coder:
Thank you two for your input, the project is set to Win32 console application, but I found the .exe in the release folder.

Thanks again guys.
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Layla_2401 is offline Offline
22 posts
since Sep 2004
Mar 27th, 2005
0

Re: Command-line Arguments.

>but I found the .exe in the release folder.
I was close. Most people who post questions here I wouldn't expect to compile in release mode.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 27th, 2005
0

Re: Command-line Arguments.

I do have another question though,
Now that I have located and ran the .exe from the command line, the program isn't running correctly, while it does from IDE. At this stage I'm not actually passing any arguments to main, I'm simply calling the program as follows:

c:\>Server

Is this a common problem caused by something I've overlooked (or needs to be modified) or is related entirely to my code?

Your help is highly appreciated.
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Layla_2401 is offline Offline
22 posts
since Sep 2004
Mar 27th, 2005
0

Re: Command-line Arguments.

If the program relies on command line arguments, not passing them will result in incorrect behavior (in the form of an error message if you wrote your program correctly).
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004
Mar 30th, 2005
0

Re: Command-line Arguments.

I got it, Thanks again.
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Layla_2401 is offline Offline
22 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Break Out Of A Function~
Next Thread in C++ Forum Timeline: another oop error cant solve :(





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC