This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C Include Files and NT-Enviroment-Variables

I tried to specifiy an additional Includepath in µ-Vision 2 under
Options for Target->C51->Include Paths.
This worked well with a hardcoded path.
Now I want to ste this path in a Winodws-NT-Enviroment-Variable using the Dos command "set INCPATH=D:\INC".
If I use %INCPATH% or $(INCPATH) it dosn't work.
Can someone help me?

  • As far as I know, environment variables in Windows NT are configured via Control Panel.
    - Mike

  • Thanks for fast reply. But the Problem is not to set the variables.
    The Problem is:
    When I enter the Variables in the dialog in µvision2, they are not interpreted correct.
    So I search for the right Syntax to enter them in the "Options for Target->C51->Include Path"-Dialog.

  • Yes, expansion of Environment strings would be a very useful feature - not only here, but in any file specification;

    No, I don't think Keil supports it anywhere. :-(

    Any particular reason why you want to pass this info via Environment strings rather than in the uVision Project file?

  • If I use %INCPATH% or $(INCPATH) it dosn't work.

    That's because INCPATH is a compiler directive. It is NOT an environment variable the compiler looks for.

    There IS an include path that the compiler looks for and you can change THAT environment variable to do what you want.

    That environment variable is C51INC.

    Here's how to do what you want.

    1. Exit uVision2. If you change the environment while uVision2 is running, uVision2 will continue using the environment when it started.

    2. I did this in 2000, but NT should be the same. Select My Computer, Properties, Advanced, Environment Variables.

    3. Add C51INC and insert the following paths: C:\KEIL\C51\INC\; (the path for the standard library include files), C:\KEIL\C51\INC\CHIP_VENDOR\; (the path to the chip-specific header file--if you use one), YOUR_PATH\; (your path(s)).

    4. Check that the path looks right in the command window.

    5. Start uVision2. Now, you must disable uVision2 from setting the C51INC environment variable.

    6. Open File Extensions, Books, and Environment from the Project menu and click on the Environment Setup tab.

    7. Uncheck Use Settings from TOOLS.INI.

    8. Delete the setting for the INC Folder. It should be blank.

    Now, when you build your project, the C51INC environment variable will contain the settings you made in your environment setup in NT.

    There are a whole lot of reasons why this is a bad idea, however, I don't think I need to go into them.

    Jon