Undefined symbols: gradfd

User ForumUndefined symbols: gradfd
n_antonov asked 2 years ago

Dear all,

I have been trying to run a readily-available code, but it gives me the following error:

Undefined symbols:
gradfd            C:\gausslt9.0\arbz_msm.opt(98)

Any suggestions?

15 Answers
aptech Staff answered 2 years ago

gradfd is a procedure from the Optmum GAUSS application module. If you have the Optmum application module installed correctly, this procedure should be inside of a file called gradient.src inside your GAUSSHOME/src directory. (In your case the exact directory would be C:\gausslt9.0\src).

If you don't have Optmum installed, you should get an error complaining that GAUSS cannot find optmum.lcg when it executes the statement:

library optmum;

at the start of the program.

If you do not have Optmum you can contact Aptech to obtain a copy.

n_antonov answered 2 years ago

I do have the Optmum module installed and I do have the gradient.src file, but strangely enough, it is still not working.

aptech Staff answered 2 years ago

I think there is something wrong with the Optmum installation. To see if GAUSS can find the gradient.src file, try running this file by entering:

run gradient.src

from the command prompt. If it is installed correctly, GAUSS will be able to find that file without specifying the path. If that command does not return an error, then enter:


at the command prompt. This will list all of the variables in your GAUSS workspace along with GAUSS procedures. Check to see if gradfd is in the list returned by the show command.

n_antonov answered 2 years ago

Thank you very much for your help! I followed your suggestions, run the gradient.src file without any error, typed in "show" and gradfd was in the list of the variables. Still, something must be wrong...

aptech Staff answered 2 years ago


The quick workaround is to #include the gradient.src by adding this line towards the top of your program file.

#include gradient.src

#include is pretty much like telling GAUSS to copy and paste another file into your program at that point.

Towards a Fix
Most likely the problem is in your Optmum library file. Library files in GAUSS are just text files that tell GAUSS what it can find (specific procedures, variables, etc) and where it can find them. If you open your optmum.lcg file, around line 58 or so, you should see:

    gradre                           : proc : 118
    gradfd                           : proc : 188
    gradcd                           : proc : 256

You can find this file in GAUSSHOME/lib. I am guessing, however, that you will see something like this instead:

    gradre                           : proc : 118
    gradfd                           : proc : 188
    gradcd                           : proc : 256

If that is the case, removing the incorrect path should resolve the issue.

n_antonov answered 2 years ago

I tried your quick turnaround, added

#include gradient.src

to the code. Then this one appears:

Undefined symbols:
_grdh c:\gausslt9.0\src\gradient.ext(23)
_grnum c:\gausslt9.0\src\gradient.ext(24)
_grsca c:\gausslt9.0\src\gradient.ext(25)
_grstp c:\gausslt9.0\src\gradient.ext(26)

I'm a bit confused. Not a regular GAUSS user, accidentally has to use it for my Master Thesis. Obviously the problem is now with this gradient.ext file.

Let me also add that I opened my optmum.lcg file and this is everything I have there:

QNewton : proc : 90
_bfgs : proc : 157
qnewtonset : proc : 428

_qn_RelGradTol : matrix : 23
_qn_MaxIters : matrix : 24
_qn_GradProc : matrix : 25
_qn_PrintIters : matrix : 26
_qn_ParNames : matrix : 27
_qn_RandRadius : matrix : 28

optmum : proc : 1

_op_ver : matrix : 21
_opalgr : matrix : 22
_opcoef : matrix : 23
_opdfct : matrix : 24
_opditer : matrix : 25
_opparnm : matrix : 26
_opstep : matrix : 27
_opshess : matrix : 28
_opfhess : matrix : 29
_opmbkst : matrix : 30
_opgtol : matrix : 31
_ophsprc : matrix : 32
_opgdprc : matrix : 33
_opgdmd : matrix : 34
_opmiter : matrix : 35
_opitdta : matrix : 36
_oprteps : matrix : 37
_opusrch : matrix : 38
_opdelta : matrix : 39
_opmxtry : matrix : 40
_opstmth : string : 41
_opmdmth : string : 42
_opkey : matrix : 43
_opmtime : matrix : 44
_opgrdh : matrix : 45
_opusrgd : matrix : 46
_opusrhs : matrix : 47


aptech Staff answered 2 years ago

If that is the entire contents of your optmum.lcg file, then this is your problem. It is missing a few files and also has references to QNewton which should be in the regular GAUSS library (i.e. gauss.lcg). I am not sure where you got this, but it is not the standard Optmum library that Aptech distributes.

n_antonov answered 2 years ago

As I said, I'm a complete rookie. Second day dealing with the programme. What I've shown is what I have. Apparently there's something wrong with it and I'll have to continue working on it.

aptech Staff answered 2 years ago

No offense intended at all, I was just pointing out that you are having the problem because someone gave you a hacked up version of Optmum.

n_antonov answered 2 years ago

As a matter of fact, I am a student and requested a free version of GAUSS Light (since it was mentioned on the website that students get this version at no cost) but I am still waiting for a reply. Anyways, I'm not going to use this programme regularly, it is just a code that I need to run for my Master Thesis.

n_antonov answered 2 years ago

Let's assume that I fixed my previous problems. But as it often happens with this kind of problem, it leads to another set of problems while running the code:

c:\gausslt9.0\src\datatran.src(170) : error G0276 : 'delif' : Illegal use of reserved word
c:\gausslt9.0\src\datatran.src(177) : error G0156 : 'x' : Illegal redefinition of procedure
c:\gausslt9.0\src\datatran.src(185) : error G0156 : 'e' : Illegal redefinition of procedure

Any suggestions on troubleshooting?

aptech Staff answered 2 years ago

You should not need to use any of the procedures in datatran.src for what you are doing. Here are the first things that come to mind:

  1. Illegal redefinition errors can often be solved by using the new command at the top of the program. GAUSS will not allow you to have a procedure and a variable with the same name at the same time. If you run a program with a variable named beta and then a program with a procedure named beta, you will get an 'illegal redefinition' error. new clears out your symbols so that you don't have left over symbols causing problems for a different program.
  2. Make sure that 'dataloop translation' is off. On GAUSS 9 it should be under the menu Configure->Preferences->Run Options. If 'dataloop translation' is on, then that could cause your program to use some of the code from datatran.src.
n_antonov answered 2 years ago

"Dataloop Translation" has always been switched off. The only thing that I'm doing is trying to run a readily available code that I downloaded. Then problems appear and I try to fix them one by one, at first it was optmum and gradfd, now it is this one. The problem does not seem to appear in the downloaded script, but in the very functions that are integrated in Gauss (as in datastran in this case) and this is the most frustrating part.

Thank you once again for your patience and suggestions!

n_antonov answered 2 years ago

And just to mention, "delif" is not used anywhere in the script, how come is it reserved?

n_antonov answered 2 years ago

And there are no "x" or "e" procedurs defined in my script either.