Community discussion forum

Command-line Path

  • 2 years ago

    I am working on a windows XP system.  I am doing a command line compile and link using a makefile.  It works except for the fact that it cannot find some header files.

    It has been a long time since I have done this sort of build.  I remember that the path a compiler uses to find a header file is determined by the "Path" that you see when you type "path" on the command line.

    How do you add a new path to the "path"on the command line?  Isn't this what we need to do if the compiler cannot find a header file?

    I think it is

    path= 'PATH'+'C:\somedirectory;'

    or something like that or maybe you have to put a dollar sign in front of the path.  I need to do this just right or else I might wipe out the path string.

  • 2 years ago

    You should be able to specify an include directory with a switch to the compiler. For instance, in GCC you can use the -I switch (dash i). Example: "gcc -I. -IC:/programming/inc test.c".

    If you must use the PATH (and I don't recommend it), use "SET PATH=...;%PATH%". It should only modify the path for that command line session (to permanently modify the PATH, go to system properties, then Advanced and then Environment Variables and change the PATH value).

  • 2 years ago

    To add a directory to the PATH environment variable use the following ...

     set PATH=%PATH%;<directory you want to add>

    - Lowell aka Cyberclops

Post a reply

Enter your message below

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback