~经言/歌词~

I find that the harder I work, the more luck I seem to have.
~ Thomas Jefferson (1743-1826)

Thursday, November 5, 2009

How to set the environment variable for 'CL'..

LOL...as shown in the title, this question had bothered me around 2 hours...sweat*
Anyway, what is CL?mmm, basically i also not very know what it stands for, let me do some searching first, dating the Miss Google...

Opms, i cant find any name for CL from the net, but never mind, because the name wasnt too important as long as i know what is it for, haha. CL, actually is a, mmm, errr, LOL!!!Can i say CL actually is a command?Ya, it is a command i think, haha. And this Cl actually is used for us to do compilation on our C/C++ program code, through CMD, command prompt.

Why do we need set the environment for CL since we have such an advance IDE to compile and execute our code, such as Microsoft Visual C++ 6.0 (which is i normally used in University). Hmmm, i not very sure why CL needed, but at this moment, i do need CL to do some compilation. And pls dont ask me why i must using the CL, honestly, what i can answer you is that, because the code that i am compiling now, it does need me to compile it through the use of CMD instead of the IDE.

Ya, i get some codes from the internet, about the JNI application, god, what is JNI??Honestly, i dont know much about JNI, or i never know about JNI until today. Sigh* and Sweat*...

Anyway, the reason why CL is required or what is JNI is not the purpose of this post. This post, is just a post for me to note down, how to set the environment variable for CL just in case in the future, i need this but i forget about it...haha...Being honest, i had been using CL quite often during my training period, just a year ago, but now, hehe, i forget all!!!Gosh!!!But last time, i did not need to set any environment variable, but why now is it needed?Guess i am not doing a complete installation...=.=

I had been searching through the internet to find a solution for me, and after around 2 hours searching, good, at last, i got the answer.

Actually, it is simple and very very easy, what you need to do is just open the folder of Microsoft Visual Studio\VC98\Bin, then you will see a batch script file named
VCVARS32. This is the batch script file that will help us to automatically set the environment variable for C/C++ compiler.

Please do not try to double click the batch file, as nothing is going to happen if you do so.

What you need to do is open the command prompt, cmd, and access to the folder where
VCVARS32 stored. I guess i no need to show how to get to the folder of VCVARS32. Once you access to the Bin folder, you just need to type VCVARS32, and press Enter, everything is done.

Then you can try to compile your C/C++ program code using CL, by typing
'cl name.cpp'

You will get the output saying that
'/out:name.exe name.obj', and this is just a compilation, if you want to execute your C/C++ program, you can continue to type 'name.exe', then you will see your output displayed on the cmd.

I am gonna to note this down, because i believe that i am going to forget all these things very soon, maybe one week or one month later. In order to save my time to do the same searching again, hehe, written all the steps here always a better choice for me, haha.