undefined symbols __FILE DIR

I downloaded the tspdlib package and installed it. However, when I want to perform a panel data analysis, I encounter various errors. For example, when I analyze Lee, J., Tieslau, M. (2017), "Panel LM Unit-root Tests with Level and Trend Shifts", I get the error undefined symbols __FILE_DIR. Can you give information about how this system works?

On the other hand, when I run the src file of Nazlioglu, S., Karul, C. (2017), "The panel stationary test with gradual shifts:  an application to international commodity price shocks ", I can't see the results. Where can we see the results?

Thank you.

2 Answers


  1. __FILE_DIR was first introduced in GAUSS version 19. So if you are running an older version of GAUSS, you will get an undefined symbol error when you run code which references it.

    __FILE_DIR returns a string that contains the folder in which the program you are running exists. Its purpose is to allow GAUSS to find a data file without having to specify the location of the file, or changing your GAUSS working directory. You can read more about __FILE_DIR here.
  2. SRC files are used to define procedures or functions. They don't execute the function. To see any output, you need to run a file which loads data and calls those functions. Our Guide to GAUSS Packages discusses how to run examples.

To run these examples with your older version of GAUSS, you will need to replace the statement which looks like this:

// Create file name
data_file = __FILE_DIR $+ "../examples/dataset.csv";

with this:

// Create file name
data_file = "dataset.csv";

Since __FILE_DIR will not find the location of your dataset any more, you will need to set your working directory to the location of the data file. This post discusses how to find and set your current working directory.


The __FILE_DIR Statement The __FILE_DIR statement is a tool for easily specifying a file path. This was first made available in GAUSS 18, so if you do not have GAUSS 18 or higher, you will need to change this to manually specify the data path.

Whenever GAUSS sees __FILE_DIR in a program, it replaces it with the full path to the location of the file which contains the__FILE_DIR statement.

In the pdlmlevel.e file, lines 9-10 read:

// Load date file
y = loadd(__FILE_DIR $+ "PDe.dat");

This means that GAUSS will look in the same directory that the file pdlmlevel.e is located in to load the data PDe.dat. If the tspdlib library has been installed correctly, this should in your GAUSS home directory in the directory pkgs\tspdlib\examples.

For more information about __FILE_DIR and data paths, I suggest reading our blog, "Make your code portable: Data paths".

Running a .src file To use procedures found in the tspdlib library, you need to use the examples files (not the src files) as templates. You can find these files in your GAUSS home directory in the pkgs/tspdlib/examples folder.

In general, it will be helpful to keep a few things in mind about GAUSS libraries.

  1. When working with GAUSS packages, files that end in .src are source code files and provide procedure definitions but generally do not call the procedures. This means that running .src files will not produce any results. You generally will never need to access the .src files.
  2. Example files, especially in official GAUSS packages, usually end in .e. These files are program files that can be used as templates for running your own programs and will produce results.

Finally, while these blogs do not explicitly speak about working with the tspdlib library, they do show how to have success in GAUSS working with other people's code. I suggest watching the following two video blogs dedicated to helping you work with publicly available GAUSS code:

  1. Running publicly available GAUSS code: Part 1
  2. Running publicly available GAUSS code: Part 2

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy