Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - multiple definition of 'main ' error......: (2 Items)
   
multiple definition of 'main ' error......  
I have made two different process to work in shared memory,one process shmcreator writes into shared memory another 
process shmuser read from same memory location.
 The contents of  shared memory object are defined  using a structure. All processes that want to access the shared 
memory object should use this structure to access the proper contents.
but when i m compiling error is comin like:

shmuser.o: In function `main':
shmuser.c:(.text+0x0): multiple definition of `main'
shmcreator.o:shmcreator.c:(.text+0x0): first defined here
shmuser.o:(.data+0x0): multiple definition of `progname'
shmcreator.o:(.data+0x0): first defined here
cc: D://host/win32/x86/usr/bin/ntox86-ld caught signal 1
make.exe[2]: *** [D:/qnx_nov/3nov/x86/o/3nov] Error 1
make.exe[2]: Target `all' not remade because of errors.
make.exe[2]: Leaving directory `D:/qnx_nov/3nov/x86/o'
make.exe[1]: [all] Error 2 (ignored)
D://host/win32/x86/usr/bin/make.exe -j 1 -Co-g -fMakefile all
make.exe[2]: Entering directory `D:/qnx_nov/3nov/x86/o-g'
D://host/win32/x86/usr/bin/rm -f  D:/qnx_nov/3nov/x86/o-g/3nov_g
D://host/win32/x86/usr/bin/qcc -Vgcc_ntox86     -oD:/qnx_nov/3nov/x86/o-g/3nov_g    shmcreator.o    shmuser.o   -L . -L 
D://target/qnx6/x86/lib -L D://target/qnx6/x86/usr/lib  -Wl,--rpath-link . -Wl,--rpath-link D://target/qnx6/x86/lib -Wl,
--rpath-link D://target/qnx6/x86/usr/lib    -g     
shmuser.o:(.data+0x0): multiple definition of `progname'
shmcreator.o:(.data+0x0): first defined here
shmuser.o: In function `main':
D:/qnx_nov/3nov/shmuser.c:26: multiple definition of `main'
shmcreator.o:D:/qnx_nov/3nov/shmcreator.c:25: first defined here
cc: D://host/win32/x86/usr/bin/ntox86-ld caught signal 1
make.exe[2]: *** [D:/qnx_nov/3nov/x86/o-g/3nov_g] Error 1
make.exe[2]: Target `all' not remade because of errors.
make.exe[2]: Leaving directory `D:/qnx_nov/3nov/x86/o-g'
make.exe[1]: [all] Error 2 (ignored)
make.exe[1]: Leaving directory `D:/qnx_nov/3nov/x86'
RE: multiple definition of 'main ' error......  
You have two main() in the same program, that illegal.  You have to split your process in two separate programs each 
with its own main()

-----Message d'origine-----
De : pooja chahal [mailto:community-noreply@qnx.com] 
Envoyé : Sunday, November 04, 2012 11:51 PM
À : momentics-community
Objet : multiple definition of 'main ' error......

I have made two different process to work in shared memory,one process shmcreator writes into shared memory another 
process shmuser read from same memory location.
 The contents of  shared memory object are defined  using a structure. All processes that want to access the shared 
memory object should use this structure to access the proper contents.
but when i m compiling error is comin like:

shmuser.o: In function `main':
shmuser.c:(.text+0x0): multiple definition of `main'
shmcreator.o:shmcreator.c:(.text+0x0): first defined here
shmuser.o:(.data+0x0): multiple definition of `progname'
shmcreator.o:(.data+0x0): first defined here
cc: D://host/win32/x86/usr/bin/ntox86-ld caught signal 1
make.exe[2]: *** [D:/qnx_nov/3nov/x86/o/3nov] Error 1
make.exe[2]: Target `all' not remade because of errors.
make.exe[2]: Leaving directory `D:/qnx_nov/3nov/x86/o'
make.exe[1]: [all] Error 2 (ignored)
D://host/win32/x86/usr/bin/make.exe -j 1 -Co-g -fMakefile all
make.exe[2]: Entering directory `D:/qnx_nov/3nov/x86/o-g'
D://host/win32/x86/usr/bin/rm -f  D:/qnx_nov/3nov/x86/o-g/3nov_g
D://host/win32/x86/usr/bin/qcc -Vgcc_ntox86     -oD:/qnx_nov/3nov/x86/o-g/3nov_g    shmcreator.o    shmuser.o   -L . -L 
D://target/qnx6/x86/lib -L D://target/qnx6/x86/usr/lib  -Wl,--rpath-link . -Wl,--rpath-link D://target/qnx6/x86/lib -Wl,
--rpath-link D://target/qnx6/x86/usr/lib    -g     
shmuser.o:(.data+0x0): multiple definition of `progname'
shmcreator.o:(.data+0x0): first defined here
shmuser.o: In function `main':
D:/qnx_nov/3nov/shmuser.c:26: multiple definition of `main'
shmcreator.o:D:/qnx_nov/3nov/shmcreator.c:25: first defined here
cc: D://host/win32/x86/usr/bin/ntox86-ld caught signal 1
make.exe[2]: *** [D:/qnx_nov/3nov/x86/o-g/3nov_g] Error 1
make.exe[2]: Target `all' not remade because of errors.
make.exe[2]: Leaving directory `D:/qnx_nov/3nov/x86/o-g'
make.exe[1]: [all] Error 2 (ignored)
make.exe[1]: Leaving directory `D:/qnx_nov/3nov/x86'




_______________________________________________

QNX Momentics Community Support
http://community.qnx.com/sf/go/post96822
To cancel your subscription to this discussion, please e-mail momentics-community-unsubscribe@community.qnx.com