Avatar of elepil
elepil
 asked on

Getting error using Microsot Visual C++ Express in Windows 7

I'm just beginning to learn C++ using the Microsoft Visual C++ 2008 Express edition, and I get this result when I do a build on my first program:

1>The system cannot find the path specified.
1>Project : error PRJ0002 : Error result 1 returned from 'C:\Windows\SysWow64\cmd.exe'.
1>Build log was saved at "file://c:\SourceCodeLibrary\CPP\Ex2_01\Ex2_01\Debug\BuildLog.htm"
1>Ex2_01 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

It is complaining it can't find C:\Windows\SysWow64\cmd.exe, but it's there. But when I run the program, it does run as expected. Is this a permissions problem again with Windows 7? I thought I'd ask how I can rid myself of this kind of an issue permanently because I've ran into permission problems with Windows 7 in the recent past, and it is getting annoying now. I am logged in as Administrator, so I don't know why I still do not have permissions to everything.

Advice, anyone? Thanks.
Editors IDEsApache Flex

Avatar of undefined
Last Comment
elepil

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rick Hobbs

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
js-profi

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
elepil

ASKER
I'm using Windows 7 Home Premium, I don't think it has XP Mode.

This is also the very first time I've used Visual Studio 2008 Express, and I typed in the very first program from my book by Ivor Horton. I do not know how to make any custom build step yet.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
elepil

ASKER
Thanks for responding, js-profi.

You are right, this is a console application. It was the very first example of Ivor Horton's book, Beginning Visual C++ 2008. Here is the code:

// Ex2_01.cpp
// A Simple Example of a Program
#include <iostream>

using std::cout;
using std::endl;

int main()
{
      int apples, oranges;                        // declare two integer variables
      int fruit;                                          // ... then another one
      
      {
      apples = 5; oranges = 6;                  // Set initial values
      fruit = apples + oranges;                  // Get the total fruit
      }

      cout << endl;
      cout << "Oranges are not the only fruit ..." << endl
             << "- and we have " << fruit << " fruits in all.";
      cout << endl;                                    // Output a new line character

      return 0;                                          // Exit the program
}

As you can see, it's really a simple inconsequential program, and I remember running this under Windows XP Professional, and I didn't get any errors, but I'm getting an error now with Windows 7; that's what led me to t hink that this could be OS-related.

I went through Project properties as you advised, and I'm not sure what I'm looking for. I did see what looked like path references, but they consisted of system variables (e.g. $(IntDir)\). All values are default as I have not modified any of them (not that I'd know how yet).

SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
elepil

ASKER
Well, it seems like I'm not the only one having this problem. Look at:

http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/871103ca-6015-40ce-8a59-92e47ce68aeb

This seems like a bug by Microsoft. My Visual C++ 2008.

Thanks to all of you who responded though.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
js-profi

in your link the following answer most likely spotted the issue

--------------------
the error message most likely means that cmd.exe is not in the path that the build process is launched with. this path is taken from tools->options->projects and solutions->vc++ directories, 'executable paths'. the default has $(path) as the last value so that it uses your system path, which ought to include the path to cmd.exe. if it has been modified so that it does not contain $(path), or your system path environment variable does not include the path to cmd.exe, then you can add the path to cmd.exe yourself and that should address this issue.
----------------------

it means the error comes from writing the .manifest file which (automatically) was written after each build.

go to the

     tools - options - projects - vc++ directories - executables

and check the paths listed there whether they were valid. add the C:\Windows\SysWow64 as path where the cmd.exe resides. that should solve the issue.


elepil

ASKER
js-profi, I did what you said, and I already see this entry in there:

$(SystemRoot)\SysWow64

When I opened up a command shell and tped in "set", it showed:

SystemRoot=C:\Windows

So that tells me the path to cmd.exe is already in there.

Is that what you were referring to?