How to use batch files to set up enviroment variables?

Started by Ficko, May 08, 2009, 07:56:41 PM

Previous topic - Next topic

Ficko

Hi!

I like to use RadAsm to write some "C" program and use Intel C++ compiler.

Since Intel C++ use his and Visual Studio enviroment as well the preparation of the enviroment vars are a maze.

But there is a bat file "iclvars.bat", which does the job -takes one paramater for the architecture-
And "vcvarsall.bat" from VS have to be run as well.

I just don't know how to integrate them into RadAsm. :red

"cpp.ini"
[Environment] section dosn't seems to accept ".bat" files.

Any TIPs are appreciated,
Ficko


dedndave

go into the control panel - System Icon (i.e. My Computer/Properties) - Advanced - Environment variables button
you can set System env variables there and they will stick
the link below has some examples, with differently named folders - you have to scroll down a bit

http://faculty.kfupm.edu.sa/COE/mudawar/coe205/tools/index.htm

otherwise, if you open the command prompt and set one, it is only good until you close that window

PauloH

Hi, Ficko.

Using RadAsm:  click Option-->Environment variables. This opens a dialog box where you can define your variables in a very easy way:
Name:
Path
Value:
c:\masm32\bin; --> Do not forget the (;)

Restart RadAsm and click: Tools --> Goto Dos

At the prompt command type:
path

Then you can see your path addition.

Kind regards.
PauloH

Ficko

Thanks guys for the reply but I think you do not thoroughly got my pain. ::)

I want to avoid the painfull manual set up of variables!

This were almost unresonable anyway since you have somany choices depends what architecture you wanna use
- "ia32","ia32_intel64","intel64","ia32_ia64","ia64" not to speak about VS complex set up for his enviroment.-

But all this is nicelly solved by the provided batch files -"iclvars.bat","vcvarsall.bat"-

So what I am looking for a way to start these batch files according your choice of prg. language and architecture.

Like I would create a copy of "cpp.ini" call it "Icpp32.ini" .... and it would start "iclvars.bat with parameter 'ia32'" for Intel C++ and "vcvarsall.bat" to set up VS properly.

Or some simile hookup but I can't find anything in the "Help" and do not wanna belive it's impossible to do. :(

Regards,
Ficko






dedndave

perhaps you want something like this ?

select the batch file you want for (for example) visual studio
create a desktop shortcut for that batch file
change the icon for the desktop shortcut to visual studio icon
the batch file sets the environment variables
at the end of the batch file, insert the name of a small program (you write this program) vsstart.exe
vsstart.exe executes visual studio

is this what you mean ?

KetilO

Hi Ficko

you could just create a new batch file that calls the other batch files before startin RadASM.

RadASM.bat

call iclvars.bat ia32
vcvarsall.bat
RadASM.exe

KetilO

Ficko

Thanks KetilO!

I thought about that I just hopped that there is a possibility I had missed to comfortable switch between programming languages in the RAD IDE.

Like putting the batch files, which should be called in the appropriate "ini" files.

But I guess -from your reply - it's not possible.

Regards,
Ficko

Ficko

Hi KetilO!

I tried your proposal but it dosn't work. :(

It seems that RadASM creating his own new process the previous settings get dropped.

This is my batch:

@call "C:\Program Files (x86)\Intel\Compiler\11.0\074\cpp\bin\intel64\iclvars_intel64.bat"
if exist "C:\Program Files (x86)\Intel\Compiler\11.0\074\cpp\tbb\em64t\vc9\bin\tbbvars.bat" @call "C:\Program Files (x86)\Intel\Compiler\11.0\074\cpp\tbb\em64t\vc9\bin\tbbvars.bat"
if exist "C:\Program Files (x86)\Intel\Compiler\11.0\074\cpp\mkl\tools\environment\mklvarsem64t.bat" @call "C:\Program Files (x86)\Intel\Compiler\11.0\074\cpp\mkl\tools\environment\mklvarsem64t.bat"
if exist "C:\Program Files (x86)\Intel\Compiler\11.0\074\cpp\ipp\em64t\tools\env\ippenvem64t.bat" @call "C:\Program Files (x86)\Intel\Compiler\11.0\074\cpp\ipp\em64t\tools\env\ippenvem64t.bat"
@echo Starting RAD IDE
RadASM.exe

There is my CMD screen -attached-:

And this is from RadASM CMD window:

ICL /O1  "Console.cpp"
Intel(R) C++ Compiler Professional for applications running on IA-32, Version 11.0    Build 20090318 Package ID: w_cproc_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

ICL: warning #10114: Microsoft Visual C++ not found in path
Console.cpp
Console.cpp(2): catastrophic error: could not open source file "iostream"
#include <iostream>
                     ^

compilation aborted for Console.cpp (code 4)

Make error(s) occured.
Total compile time 312 ms

You can see that the enviromet got set up for Intel64 but in RadASM it "jumps back" to IA-32 and VS enviroment is missing.

There is the sample code, which compiles fine if I start my batch from the CMD and use "ICL /O1 Console.cpp"

#include <iostream>
#include <math.h>

using namespace std;

float rad, area, volume;
float pi = 3.14159;

main()
{
   cout << "Enter the radius of the sphere ";
   cin  >> rad;
   area = 4. * pi * pow(rad,2);
   volume = (4.0 / 3.0) * pi * pow(rad,3);
   cout << "\n";
   cout << rad << " cm is the value of the radius\n\n";
   cout << "In a sphere of radius " << rad
        << " cm, the surface area is " << area
        << " sq cm \nand its volume is " << volume
        << " cubic cm.\n\n";
   cin  >> rad;
return(0);
}

I hope you have some more guesses what can be done!?  ::)

Regards,
Ficko

[attachment deleted by admin]

KetilO

Hi Ficko

I have no idea why it fails for you.
Maybe this can help you track down the problem. It sets up the environment for masm:

ml.bat
set path=c:\masm32\bin;%path%
set include=c:\masm32\include
set lib=c:\masm32\lib

rad.bat
call ml.bat
radasm.exe

Important:
RadASM sets up the environment for each assembler/compiler.
If your compiler is not the default (ie. the first in the list Option / Programming Languages) then the setup from the batch file will be lost.
Also you must delete all environment variables using Option / Environment Variables.

KetilO