Error: Symbol #include is not defined in current scope

Dear ROOT expert:

My script encountered the following error during execution:

Info in TMultiLayerPerceptron::Train: Using 109 train and 109 test entries.
Network with structure: price0,price1,price2,price3,price4:10:price5
inputs with low values in the differences plot may not be needed
Error: Symbol #include is not defined in current scope train.c:82:
Error: Symbol exception is not defined in current scope train.c:82:
Syntax Error: #include train.c:82:
*** Interpreter error recovered ***

But actually I already include in my script.

Any idea on this?

Thanks,Gang
data.txt (14.7 KB)
train.c (5.19 KB)

I suggest to fix your C++ code by running your script with ACLIC (ie normal compiler)
root > .x train.c+

you will see that you are missing several includes and variable declarations. Fix these problems first and let’s see if the symptom persists.

Rene

Dear Brun:

Thanks for your help. The following is the error message in compiling. Seems all related with 'â , but what does â stands for?

root [3] .x train.c+
Info in TUnixSystem::ACLiC: creating shared library /afs/cern.ch/user/q/qing/qinqi/./train_c.so
In file included from /afs/cern.ch/user/q/qing/qinqi/train_c_ACLiC_dict.h:34,
from /afs/cern.ch/user/q/qing/qinqi/train_c_ACLiC_dict.cxx:16:
/afs/cern.ch/user/q/qing/qinqi/./train.c: In function â:
/afs/cern.ch/user/q/qing/qinqi/./train.c:75: error: â was not declared in this scope
/afs/cern.ch/user/q/qing/qinqi/./train.c:86: error: request for member â in â, which is of non-class type â
/afs/cern.ch/user/q/qing/qinqi/./train.c:89: error: â was not declared in this scope
/afs/cern.ch/user/q/qing/qinqi/./train.c:89: error: â was not declared in this scope
/afs/cern.ch/user/q/qing/qinqi/./train.c:89: error: expected type-specifier before â
/afs/cern.ch/user/q/qing/qinqi/./train.c:89: error: expected ;' before â /afs/cern.ch/user/q/qing/qinqi/./train.c:93: error: request for member â in â, which is of non-class type â /afs/cern.ch/user/q/qing/qinqi/./train.c:95: error: â was not declared in this scope /afs/cern.ch/user/q/qing/qinqi/./train.c:96: error: â was not declared in this scope /afs/cern.ch/user/q/qing/qinqi/./train.c:107: error: â was not declared in this scope /afs/cern.ch/user/q/qing/qinqi/./train.c:107: error: expected type-specifier before â /afs/cern.ch/user/q/qing/qinqi/./train.c:107: error: expected;’ before â
/afs/cern.ch/user/q/qing/qinqi/./train.c:108: error: â was not declared in this scope
/afs/cern.ch/user/q/qing/qinqi/./train.c:108: error: expected type-specifier before â
/afs/cern.ch/user/q/qing/qinqi/./train.c:108: error: expected ;' before â /afs/cern.ch/user/q/qing/qinqi/./train.c:124: error: â was not declared in this scope /afs/cern.ch/user/q/qing/qinqi/./train.c:134: error: â was not declared in this scope /afs/cern.ch/user/q/qing/qinqi/./train.c:144: error: â was not declared in this scope /afs/cern.ch/user/q/qing/qinqi/./train.c:191: error: â was not declared in this scope /afs/cern.ch/user/q/qing/qinqi/./train.c:191: error: expected type-specifier before â /afs/cern.ch/user/q/qing/qinqi/./train.c:191: error: expected;’ before â
/afs/cern.ch/user/q/qing/qinqi/./train.c:197: error: invalid use of incomplete type â
/afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/include/TVirtualPad.h:46: error: forward declaration of â
/afs/cern.ch/user/q/qing/qinqi/./train.c:203: error: invalid use of incomplete type â
/afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/include/TVirtualPad.h:46: error: forward declaration of â
g++: /afs/cern.ch/user/q/qing/qinqi/train_c_ACLiC_dict.o: No such file or directory
Error in : Compilation failed!
Error: Function train() is not defined in current scope :0:
*** Interpreter error recovered ***

Hi,

There is a problem with your compiler installation ; it is replacing all symbol names by this “â”.

The real output is more like:In file included from /Users/pcanal/Downloads/train_c_ACLiC_dict.h:34, from /Users/pcanal/Downloads/train_c_ACLiC_dict.cxx:16: /Users/pcanal/Downloads/./train.c: In function ‘void train()’: /Users/pcanal/Downloads/./train.c:46: error: ‘TFile’ was not declared in this scope /Users/pcanal/Downloads/./train.c:46: error: expected `;' before ‘fout’ /Users/pcanal/Downloads/./train.c:47: error: ‘TTree’ was not declared in this scope /Users/pcanal/Downloads/./train.c:47: error: ‘milk’ was not declared in this scope /Users/pcanal/Downloads/./train.c:47: error: expected type-specifier before ‘TTree’ /Users/pcanal/Downloads/./train.c:47: error: expected `;' before ‘TTree’ /Users/pcanal/Downloads/./train.c:55: error: ‘j’ was not declared in this scope /Users/pcanal/Downloads/./train.c:64: error: ‘fout’ was not declared in this scope /Users/pcanal/Downloads/./train.c:67: error: ‘TMultiLayerPerceptron’ was not declared in this scope /Users/pcanal/Downloads/./train.c:67: error: ‘mlp’ was not declared in this scope /Users/pcanal/Downloads/./train.c:67: error: expected type-specifier before ‘TMultiLayerPerceptron’ /Users/pcanal/Downloads/./train.c:67: error: expected `;' before ‘TMultiLayerPerceptron’ /Users/pcanal/Downloads/./train.c:72: error: ‘train_file’ was not declared in this scope /Users/pcanal/Downloads/./train.c:72: error: expected type-specifier before ‘TFile’ /Users/pcanal/Downloads/./train.c:72: error: expected `;' before ‘TFile’ /Users/pcanal/Downloads/./train.c:73: error: ‘milk1’ was not declared in this scope /Users/pcanal/Downloads/./train.c:73: error: expected primary-expression before ‘)’ token /Users/pcanal/Downloads/./train.c:73: error: expected `;' before ‘train_file’ /Users/pcanal/Downloads/./train.c:81: error: ‘mlp1’ was not declared in this scope /Users/pcanal/Downloads/./train.c:81: error: expected type-specifier before ‘TMultiLayerPerceptron’ /Users/pcanal/Downloads/./train.c:81: error: expected `;' before ‘TMultiLayerPerceptron’ /Users/pcanal/Downloads/./train.c:82: error: ‘mlpa’ was not declared in this scope /Users/pcanal/Downloads/./train.c:82: error: expected type-specifier before ‘TMLPAnalyzer’ /Users/pcanal/Downloads/./train.c:82: error: expected `;' before ‘TMLPAnalyzer’ /Users/pcanal/Downloads/./train.c:96: error: ‘val0’ was not declared in this scope /Users/pcanal/Downloads/./train.c:104: error: ‘val1’ was not declared in this scope /Users/pcanal/Downloads/./train.c:112: error: ‘val2’ was not declared in this scope /Users/pcanal/Downloads/./train.c:157: error: ‘hpx’ was not declared in this scope /Users/pcanal/Downloads/./train.c:157: error: expected type-specifier before ‘TH2F’ /Users/pcanal/Downloads/./train.c:157: error: expected `;' before ‘TH2F’ /Users/pcanal/Downloads/./train.c:163: error: invalid use of incomplete type ‘struct TAxis’ /Users/pcanal/root_working/code/root.untouched/include/TVirtualPad.h:46: error: forward declaration of ‘struct TAxis’ /Users/pcanal/Downloads/./train.c:169: error: invalid use of incomplete type ‘struct TAxis’ /Users/pcanal/root_working/code/root.untouched/include/TVirtualPad.h:46: error: forward declaration of ‘struct TAxis’ i686-apple-darwin10-g++-4.2.1: /Users/pcanal/Downloads/train_c_ACLiC_dict.o: No such file or directory Error in <ACLiC>: Compilation failed!

Cheers,
Philippe.

Dear Experts:

I have modifed the script and now ‘.x train.c+’ runs fine without any error or warning message. But still the program would stop when root.exe has occupied ~10% of meomory, and the following error message will jump out:

Error: Symbol #include is not defined in current scope :0:
Error: Symbol exception is not defined in current scope :0:
Syntax Error: #include :0:
Error: Symbol G__exception is not defined in current scope :0:
Error: type G__exception not defined FILE: LINE:0
(void)0

Any idea that how could I free the memory in my script? Seems delete does not work. When I applied ‘delete’ in my script, the following error appeared:

*** Break *** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:

#0 0x0000003a7a299d75 in waitpid () from /lib64/libc.so.6
#1 0x0000003a7a23c331 in do_system () from /lib64/libc.so.6
#2 0x00002b526e515052 in TUnixSystem::StackTrace() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCore.so
#3 0x00002b526e515b05 in TUnixSystem::DispatchSignals(ESignals) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCore.so
#4
#5 0x0000003a7a552ae8 in main_arena () from /lib64/libc.so.6
#6 0x00002b527403c71b in TMultiLayerPerceptron::~TMultiLayerPerceptron() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libMLP.so
#7 0x00002b52740571c4 in G__G__MLP_98_0_75(G__value*, char const*, G__param*, int) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libMLP.so
#8 0x00002b526ed14ca4 in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#9 0x00002b526edc41d0 in G__execute_call () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#10 0x00002b526edc59b9 in G__call_cppfunc () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#11 0x00002b526eda0fd9 in G__interpret_func () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#12 0x00002b526ed8fffa in G__getfunction () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#13 0x00002b526edbe7db in G__delete_operator () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#14 0x00002b526edf7341 in G__exec_statement () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#15 0x00002b526edfa5d4 in G__exec_loop(char const*, char*, std::list<G__FastAllocString, std::allocator<G__FastAllocString> > const&) ()
from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#16 0x00002b526edf5c92 in G__exec_statement () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#17 0x00002b526eda2784 in G__interpret_func () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#18 0x00002b526ed900d0 in G__getfunction () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#19 0x00002b526ed62b9a in G__getitem () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#20 0x00002b526ed66b4f in G__getexpr () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#21 0x00002b526ed74664 in G__calc_internal () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#22 0x00002b526ee01b54 in G__process_cmd () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCint.so
#23 0x00002b526e4d8fa5 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCore.so
#24 0x00002b526e4d63a3 in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCore.so
#25 0x00002b526e4369d9 in TApplication::ExecuteFile(char const*, int*, bool) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCore.so
#26 0x00002b526e434c75 in TApplication::ProcessLine(char const*, bool, int*) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libCore.so
#27 0x00002b526fa9c083 in TRint::Run(bool) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libRint.so

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#5 0x0000003a7a552ae8 in main_arena () from /lib64/libc.so.6
#6 0x00002b527403c71b in TMultiLayerPerceptron::~TMultiLayerPerceptron() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/5.27.04/x86_64-slc5-gcc43-opt/root/lib/libMLP.so

Thanks,Gang
train.c (6.54 KB)

Hi,

I can not reproduce this problem. You could try to use valgrind (valgrind root.exe -b -l -q train.c) or find a way to isolate which lines lead to [quote]Error: Symbol #include is not defined in current scope :0:[/quote]possibly by using gdb. See also your similar post /viewtopic.php?t=10858

Philippe.