![]() |
| | #1 |
| Registered User Join Date: Jun 2007 Location: UK
Posts: 22
| 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? |
| DDAZZA is offline | |
| | #2 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| 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.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #3 |
| Registered User Join Date: Jun 2007 Location: UK
Posts: 22
| sorry, can u tell me how i would complie a file on my desktop |
| DDAZZA is offline | |
| | #4 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| You would open a console, navigate to your desktop folder (typically C:\Documents and Settings\username\Desktop), and follow the steps above.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #5 |
| Registered User Join Date: Jun 2007 Location: UK
Posts: 22
| 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 Last edited by DDAZZA; 06-10-2007 at 08:21 AM. Reason: added exe location |
| DDAZZA is offline | |
| | #6 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| 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.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #7 |
| Registered User Join Date: Jun 2007 Location: UK
Posts: 22
| via the console ye there is a vcvars32.bat when i run that first the console returns Code: usage: cl [option...] filename...[\link linkoption...] |
| DDAZZA is offline | |
| | #8 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| Option can be many things. Pass /help and you should get a list. And yes, filename is the path of the code file.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #9 |
| Registered User Join Date: Jun 2007 Location: UK
Posts: 22
| 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 ? |
| DDAZZA is offline | |
| | #10 |
| Deathray Engineer Join Date: Mar 2007
Posts: 3,211
| Put quotes around the path and filename.
__________________ |
| MacGyver is offline | |
| | #11 |
| Registered User Join Date: Jun 2007 Location: UK
Posts: 22
| ok ty i now get the error: Code: 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? |
| DDAZZA is offline | |
| | #12 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| 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.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #13 |
| CSharpener Join Date: Oct 2006
Posts: 5,334
| And why so many trouble just to not compile in the IDE?.. Just curios.
__________________ If I have eight hours for cutting wood, I spend six sharpening my axe. |
| vart is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C window code - How easy is it to intergrate cmd code | spadez | C Programming | 23 | 04-20-2009 07:35 AM |
| OOP Question DB Access Wrapper Classes | digioz | C# Programming | 2 | 09-07-2008 04:30 PM |
| Error running program in cmd - cygwin.dll missing - | JFonseka | C Programming | 5 | 08-27-2007 12:12 PM |
| Converting cmd arg to int | InstaDeath | C++ Programming | 5 | 03-17-2004 09:45 PM |
| Little help with CMD | robid1 | C Programming | 2 | 02-23-2003 04:09 AM |