Simple VC++ problem

Started by
5 comments, last by julienX 21 years, 3 months ago
I have just bought TOTWGPG by Andre LaMothe and included on the CD is an introductory version of Visual C++, and installed it but am having problems with even the simplest program! No matter what I compile I get errors so I decided to start by compiling a console "hello world" program since I am completely new to VC++. But I still get an error: --------------------Configuration: test - Win32 Debug-------------------- Compiling... Error spawning cl.exe test.exe - 1 error(s), 0 warning(s) I am completely sure that there arenn''t any errors in my code, so what is the problem? Here is my code just in case: #include <iostream.h> int main() { cout <<"Hello World\n"; return 0; } I just don''t get it, is it something to do with the iostream library? Plus to add to my confusion I start a new project and select the already made "Hello World" program, but it still doesnt compile and gives the same error as above. What is going on? (i bet there is something very simple that i have missed)
chacha
Advertisement
Please give me the exact Error code for this error and I could help 10x more. Right now all I can find is that your best bet is:
-Reboot your computer then try again
-If it still doesn''t work, reinstall VC++

Sorry, but I''ve never come across this before, and you didn''t supply the exact error code.

-This is where the world drops off
-ryan@lecherousjester.com
it looks like it can''t find cl.exe on your path.

Either it didn''t install correctly, or you need to set your path so it knows where to find cl.exe... maybe it''s the VCVARS crap when you install it, I don''t know... but that error means it can not execute cl.exe, which it needs to compile your program with.



try this

#include "stdafx.h"
#include <iostream.h>

int main()
{
cout <<"Hello World\n";

return 0;
}

im new too, when i create a win32 console project, and then select either a simple application or 'hello world' application,

#include "stdafx.h"

this is always present if i remove it then i get the same error message as you. if i create an empty project and then add a source file then programs will compile without that line.

if someone can explain what this, i would be greatfull.

[edited by - deal on December 26, 2002 11:39:14 AM]
The problem is that the IDE (Integrated Development Environment) can''t find the cl.exe, the command line compiler it uses to compile the code. Do a search for vcvars32.bat, which sets the environmental variables. Open it in a text editor and copy its contents into the environmental variables set in your operating system. Every version of windows does this differently, but you should be able to find it. It''ll be, most likely, in the ''system'' control panel option. You''ll need to add to PATH a path in there for C:\Program Files\Visual Studio...\VC98, or something like that, plus a few more. Give the vcvars32.bat a look.

Once the environmental PATH variable is properly updated, then the IDE can find cl.exe


Good luck!
What`s your project type??Win32 Console Application???
hi..

If you get this error, your roaming profile records an incorrect directory for the Microsoft Visual C++ installation on the PC. Consequently, Microsoft Visual C++ cannot locate the compiler executable.

start vc++ klick on the options menu (extras/options)
click on the "directorys" tab
select "executables" from the (right) dropdownlist
now you should see some paths below..

cl.exe should be found in one of this paths (directorys)
if not, locate cl.exe and add its path to the list.

if this dont helps ...
install the last visual studio servicepack ..

if you are using a network/workstation read this:

The problem occurs because Microsoft Visual C++ is not yet installed in a uniform directory across PCs. This inconsistency is being resolved actively, but slowly. In the mean time, here''s a fix:

Exit Microsoft Visual C++.
Select Start -> Run... and enter regedit. This starts the registry editor.

Carefully navigate down this path:
H_KEY_CURRENT_USER
Software
Microsoft
DevStudio
6.0
BuildSystem
Componenets
Platforms
Win32 (x86)
Directories

Carefully right-click on the Directories key and choose Delete.
Exit from the registry editor.]

regards..


This topic is closed to new replies.

Advertisement