Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Primme 1.1 compilation fails multiple definition of `main'

psing51
New Contributor I
488 Views

Dear Sir/Madam
I need PRIMME-V1 for building SLEPC so i am trying to build the application using intel 2015 suite on CentOS 6.5.
I am getting following error:-

mpiifort -fPIC -o seq_dprimme driver_seq.o readuc.o shared_utils.o ssrcsr.o  ilut.o amux.o -L/opt/user1-INTEL/finaluser1/ToolsInstaller/Mechanical/OOFEM/PRIMME -I/opt/user1-INTEL/finaluser1/ToolsInstaller/Mechanical/OOFEM/PRIMME/PRIMMESRC/COMMONSRC -I/opt/user1/user1_Installed/Ajavascript:void(0)pplication_Dependencies/include -lprimme -llapack -lblas -lm  
driver_seq.o: In function `main':
driver_seq.c:(.text+0x0): multiple definition of `main'
/opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/for_main.o:for_main.c:(.text+0x0): first defined here
/opt/intel/composer_xe_2015.3.187/compiler/lib/intel64/for_main.o: In function `main':
for_main.c:(.text+0x2a): undefined reference to `MAIN__'
make[1]: *** [seq_dprimme] Error 1
make[1]: Leaving directory `/opt/user1-INTEL/finaluser1/ToolsInstaller/Mechanical/OOFEM/PRIMME/DTEST'
make: *** [seq_dprimme] Error 2
/opt/user1/user1_Installed/Application_Dependencies/lib/libprimme.a

The following commands sets the appropriate compilation options.     

tar -xzvf primme_v1.1.tar.gz
        cd PRIMME
        sed -i "/^TOP =/c TOP = $PWD" Make_flags
        sed -i "/^CC/c CC = $MPIC_COMP" Make_flags
        sed -i "/^F77/c F77 = $MPIF_COMP" Make_flags      
        sed -i "/^CFLAGS/c CFLAGS = -O2 -fPIC" Make_flags
        sed -i "/^FFLAGS/c FFLAGS = -O2 -fPIC" Make_flags
        sed -i "/^LDR/c LDR = $MPIF_COMP -fPIC"  Link_flags
        sed -i "/^ LDFLAGS/c LDFLAGS =  "  Link_flags
        sed -i "/^ LIBS/c LIBS = -lprimme -llapack -lblas -lm " Link_flags
        sed -i "/^INCLUDE/c INCLUDE = -I\$(COMMONDIR) -I$user_install_path/Application_Dependencies/include"  Link_flags
  
         make VERBOSE=1 all

Why the compiler reports multiple definition of main function ?.Eagerly awaiting your reply.

0 Kudos
2 Replies
psing51
New Contributor I
488 Views

ok
the issue was resolved using : -nofor_main flag.
but i want to know why the error cops up.
if you can explain the reason , then i will be able to better understand the cause of  the error!

Regards
Puneet

0 Kudos
KitturGanesh
Employee
488 Views

Puneet, you'll understand if you read through the issue at: https://software.intel.com/en-us/forums/topic/269635

_Kittur

0 Kudos
Reply