What is this error?

Feb 25, 2016 at 1:40am

ld: fatal: symbol 'main' is multiply-defined:
(file /var/tmp//cceZjOcX.o type=FUNC; file /var/tmp//ccYgP5zV.o type=FUNC);
ld: fatal: symbol '_Z4menuv' is multiply-defined:
(file /var/tmp//cceZjOcX.o type=FUNC; file /var/tmp//ccYgP5zV.o type=FUNC);
ld: fatal: file processing errors. No output written to a.out


I have currently received this error and have working some time trying to resolve it. It usually occurs with #including files that aren't necessary but this time its not that.
Feb 25, 2016 at 1:47am
Would I have to change my main's name? sine I have two mains within my directory. So two functions called "int main(){ }" are being called along with my displays "menu(){ }"?
Feb 25, 2016 at 1:53am
When I change that main and my menu functions that are being compiled together this error gets thrown:

Undefined first referenced
symbol in file
_ZNK9FBFriends11find_friendERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE /var/tmp//ccZw5Cqc.o
_ZNK9FBFriends9is_friendERK6Friend /var/tmp//ccZw5Cqc.o
_ZN9FBFriendsC1ERKS_ /var/tmp//ccZw5Cqc.o
_ZN9FBFriends4loadERSi /var/tmp//ccZw5Cqc.o
_ZN9FBFriends7advanceEv /var/tmp//ccZw5Cqc.o
_ZN9FBFriends14remove_currentEv /var/tmp//ccZw5Cqc.o
_ZNK9FBFriends8show_allERSo /var/tmp//ccZw5Cqc.o
_ZN9FBFriends5startEv /var/tmp//ccZw5Cqc.o
_ZN9FBFriends6attachERK6Friend /var/tmp//ccZw5Cqc.o
_ZN9FBFriends7currentEv /var/tmp//ccZw5Cqc.o
_ZN9FBFriends9bday_sortEv /var/tmp//ccZw5Cqc.o
_ZN9FBFriends7is_itemEv /var/tmp//ccZw5Cqc.o
_ZN9FBFriends6insertERK6Friend /var/tmp//ccZw5Cqc.o
_ZN9FBFriendsD1Ev /var/tmp//ccZw5Cqc.o
_ZN9FBFriendsC1Ev /var/tmp//ccZw5Cqc.o
_ZN9FBFriends4saveERSo /var/tmp//ccZw5Cqc.o
ld: fatal: symbol referencing errors. No output written to a.out


What in the world is all that?
Feb 25, 2016 at 2:45am
ld: fatal: symbol 'main' is multiply-defined:
I have two mains within my directory. So two functions called "int main(){ }"


There's your problem (one of them at least).
Feb 25, 2016 at 2:49am
I made a temp main to test two of my files, once I put the actual main in the directory and tested: g++ *.cc I came up with those errors. Straight up took out the temp main because it was the temp. And got the crazy looking mumbo jumbo above...
Feb 26, 2016 at 5:10am
Posting your code would be extremely helpful.
Feb 26, 2016 at 6:12am
http://www.cplusplus.com/forum/general/140198/

Post your code and your build command
Topic archived. No new replies allowed.