CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   Undefined reference to %60mainb (https://www.cfd-online.com/Forums/openfoam-installation/57527-undefined-reference-60mainb.html)

seang June 12, 2007 13:12

Hi, I am compiling OpenFOAM
 
Hi,

I am compiling OpenFOAM 1.4 with gcc 4.1.2 on OpenSUSE 10.1 and had the following strange error. Any help or hints is appreciated!

regards,
Tek Seang

SOURCE=gambitToFoam.L ; flex++ -f $SOURCE ; mv lex.yy.cc Make/linux64Gcc4DPOpt/gambitToFoam.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -IlnInclude -I. -I/home/tskuan/CFD/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC -c Make/linux64Gcc4DPOpt/gambitToFoam.C -o Make/linux64Gcc4DPOpt/gambitToFoam.o
stdin:16159: m4: Warning: Excess arguments to built-in `m4_ifdef' ignored
lex.yy.cc: In member function âvirtual int yyFlexLexer::yylex()â:
lex.yy.cc:14023: warning: use of old-style cast
lex.yy.cc:14023: warning: use of old-style cast
lex.yy.cc:14039: warning: use of old-style cast
lex.yy.cc:14599: warning: use of old-style cast
lex.yy.cc: In member function âint yyFlexLexer::yy_get_next_buffer()â:
lex.yy.cc:14847: warning: use of old-style cast
lex.yy.cc:14870: warning: use of old-style cast
lex.yy.cc:14883: warning: use of old-style cast
lex.yy.cc:14883: warning: use of old-style cast
lex.yy.cc:14904: warning: use of old-style cast
lex.yy.cc: In member function âyy_state_type yyFlexLexer::yy_get_previous_state()â:
lex.yy.cc:14952: warning: use of old-style cast
lex.yy.cc:14952: warning: use of old-style cast
lex.yy.cc: In member function âvoid yyFlexLexer::yyunput(int, char*)â:
lex.yy.cc:15012: warning: use of old-style cast
lex.yy.cc:15013: warning: use of old-style cast
lex.yy.cc:15021: warning: use of old-style cast
lex.yy.cc: In member function âint yyFlexLexer::yyinput()â:
lex.yy.cc:15088: warning: use of old-style cast
lex.yy.cc: In member function âvirtual yy_buffer_state* yyFlexLexer::yy_create_buffer(std::istream*, int)â:
lex.yy.cc:15168: warning: use of old-style cast
lex.yy.cc:15177: warning: use of old-style cast
lex.yy.cc: In member function âvirtual void yyFlexLexer::yy_delete_buffer(yy_buffer_state*)â:
lex.yy.cc:15199: warning: use of old-style cast
lex.yy.cc:15202: warning: use of old-style cast
lex.yy.cc:15204: warning: use of old-style cast
lex.yy.cc: In member function âvoid yyFlexLexer::yyensure_buffer_stack()â:
lex.yy.cc:15331: warning: use of old-style cast
lex.yy.cc:15349: warning: use of old-style cast
lex.yy.cc: In member function âvoid yyFlexLexer::yy_push_state(int)â:
lex.yy.cc:15367: warning: use of old-style cast
lex.yy.cc:15370: warning: use of old-style cast
lex.yy.cc:15370: warning: use of old-style cast
lex.yy.cc: In function âvoid* yyalloc(yy_size_t)â:
lex.yy.cc:15450: warning: use of old-style cast
lex.yy.cc: In function âvoid* yyrealloc(void*, yy_size_t)â:
lex.yy.cc:15462: warning: use of old-style cast
lex.yy.cc:15462: warning: use of old-style cast
lex.yy.cc: In function âvoid yyfree(void*)â:
lex.yy.cc:15467: warning: use of old-style cast
g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -IlnInclude -I. -I/home/tskuan/CFD/OpenFOAM/OpenFOAM-1.4/src/OpenFOAM/lnInclude -fPIC Make/linux64Gcc4DPOpt/gambitToFoam.o -L/home/tskuan/CFD/OpenFOAM/OpenFOAM-1.4/lib/linux64Gcc4DPOpt \
-lOpenFOAM -liberty -ldl -lm -o /home/tskuan/CFD/OpenFOAM/OpenFOAM-1.4/applications/bin/linux64Gcc4DPOpt/gambitT oFoam
/usr/lib/../lib64/crt1.o: In function `_start':
init.chttp://www.cfd-online.com/OpenFOAM_D...lipart/sad.gif.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [/home/tskuan/CFD/OpenFOAM/OpenFOAM-1.4/applications/bin/linux64Gcc4DPOpt/gambit ToFoam] Error 1

mattijs June 12, 2007 13:53

Think it was that that version
 
Think it was that that version of flex++ does not like ']]'. Put space inbetween any two angle brackets in gambitToFoam.L

seang June 12, 2007 23:33

Hi Mattijs, thanks for your
 
Hi Mattijs,

thanks for your suggestion! that worked wonders!

The flex++ version i am using is 2.5.31

regards,
Tek Seang

jens_klostermann June 20, 2007 10:04

Had the same problem on an Ubu
 
Had the same problem on an Ubuntu (debian based) machine.

Also change:
ansysToFoam.L
fluentToFoam.L

as suggested by Mattijs.

sradl July 2, 2007 02:08

Had a similar problem when try
 
Had a similar problem when trying to compile a new viscosity model (should give a new library). The error message is:
/usr/lib/gcc/x86_64-linux-gnu/4.1.2/../../../../lib64/crt1.o: In function `_start':
../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'

Followed by a bunch of other error messages

Can anyone help?

br
Stefan

olesen July 2, 2007 03:33

Use 'wmake libso' if you are c
 
Use 'wmake libso' if you are compiling a library.
A plain 'wmake' will attempt to create an application, which requires 'main()' and yields a failure if it is missing.

Sherlock_1812 January 30, 2014 00:22

Similar error
 
Hi,

I know this is a really old thread. But i get a similar error. I am not compiling a library, just a solver. However, I still get this error message.

Code:

/usr/lib/../lib64/crt1.o: In function `_start':
/usr/src/packages/BUILD/glibc-2.11.3/csu/../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [/home1/ms/me12s056/OpenFOAM/me12s056-2.1.1/platforms/linux64GccDPOpt/bin/thermoSolutalPisoFoam] Error 1

Any help?

wyldckat February 1, 2014 13:19

Greetings Srivaths,

This isn't enough information to work with, so here are some questions, to help isolate the source of the problem:
  1. Which Linux Distribution are you using and which architecture (32 or 64 bit)?
  2. What installation instructions did you follow for installing OpenFOAM 2.1.1.?
  3. Do you have more than one OpenFOAM version installed? If you do, how are you keeping them apart?
Best regards,
Bruno

Sherlock_1812 February 1, 2014 13:48

Hello Bruno,

I am using Ubuntu 12.04 32 bit system. The 2.1.1 version was on a cluster that i'm running my cases on.

I would like to say that I've got the issue resolved. It was a beginner's error and I just didn't spot it initially.

Thank you for your time.


All times are GMT -4. The time now is 09:02.