im not sure if this should be under C++ but its not really C++
i have Visual C++ Express
If i wrote some code a txt file and saved it as test.cpp for example
how could i compile it though the console?
Printable View
im not sure if this should be under C++ but its not really C++
i have Visual C++ Express
If i wrote some code a txt file and saved it as test.cpp for example
how could i compile it though the console?
You would call cl.exe from VC++'s bin directory. In addition, you should set some environment variables. The bin directory should also contain a batch file that sets these variables.
You made the right choice of forum. Questions about the usage of a particular compiler belong to tech.
sorry,
can u tell me how i would complie a file on my desktop
You would open a console, navigate to your desktop folder (typically C:\Documents and Settings\username\Desktop), and follow the steps above.
ahh i found it
C:\Program Files\Microsoft Visual Studio 8\VC\bin
its cl.exe
BUT
"This application has failed to start because mspdb80.dll was not found re-installing the application may fix this problem"
i gues i need to reinstall
How did you call it?
Is there a vcvars32.bat (or similar) in this bin directory, too? If so, try calling that before cl.exe.
via the console
ye there is a vcvars32.bat
when i run that first
the console returns
what is the option and is the filename the path of the C/CPP file?Code:usage: cl [option...] filename...[\link linkoption...]
Option can be many things. Pass /help and you should get a list.
And yes, filename is the path of the code file.
OMG there is a lot of options
ok i think im getting the syntax wrong
im putting
Code:cl C:/documents and settings/me/desktop/test.cpp
i get the error:
unreconised source file
because documents and settings needs the spaces replacing what do i replace them with ?
Put quotes around the path and filename.
ok ty
i now get the error:
erm im new to programmingCode:Cannot open file test.obj: permission denied
do i need to make a test.obj file wat is it?
do i need to compile with an option to exclude the test.obj file?
The .obj file is an intermediate file the compiler generates. The error means that whatever directory it tries to create it in (the VC++ bin directory, I would guess), it doesn't have write access there.
The solution is to change the working directory to where your source files are and call the compiler from there. If you've run vcvars32.bat, it should be in the PATH so "cl" should work everywhere.
And why so many trouble just to not compile in the IDE?.. Just curios.