Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.30/5 (3 votes)
I want to compile a file in linux. When I compile it in MS visual studio (windows), it works quite fine but when I try to compile in linux by issuing command:
"gcc channelassignment.cpp" I get following errors...

VB
/tmp/ccLvTU1V.o: In function `CalculateAlgo1(Input*)':
channelassignment.cpp:(.text+0x5e): undefined reference to `operator new(unsigned int)'
channelassignment.cpp:(.text+0x238): undefined reference to `operator new(unsigned int)'
channelassignment.cpp:(.text+0x323): undefined reference to `operator delete(void*)'
channelassignment.cpp:(.text+0x337): undefined reference to `operator delete(void*)'
/tmp/ccLvTU1V.o: In function `g(Channel, Set<Node>*)':
channelassignment.cpp:(.text+0x35c): undefined reference to `operator new(unsigned int)'
channelassignment.cpp:(.text+0x46c): undefined reference to `operator delete(void*)'
/tmp/ccLvTU1V.o: In function `__static_initialization_and_destruction_0(int, int)':
channelassignment.cpp:(.text+0x497): undefined reference to `std::ios_base::Init::Init()'
channelassignment.cpp:(.text+0x49c): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccLvTU1V.o: In function `Node::Node()':
channelassignment.cpp:(.text._ZN4NodeC2Ev[_ZN4NodeC5Ev]+0x10): undefined reference to `operator new(unsigned int)'
channelassignment.cpp:(.text._ZN4NodeC2Ev[_ZN4NodeC5Ev]+0x35): undefined reference to `operator delete(void*)'
/tmp/ccLvTU1V.o: In function `Set<Channel>::Set()':
channelassignment.cpp:(.text._ZN3SetI7ChannelEC2Ev[_ZN3SetI7ChannelEC5Ev]+0x29): undefined reference to `operator new(unsigned int)'
/tmp/ccLvTU1V.o: In function `Set<Node>::Set()':
channelassignment.cpp:(.text._ZN3SetI4NodeEC2Ev[_ZN3SetI4NodeEC5Ev]+0x28): undefined reference to `operator new(unsigned int)'
/tmp/ccLvTU1V.o: In function `Set<Node>::CopySet(Set<Node> const*)':
channelassignment.cpp:(.text._ZN3SetI4NodeE7CopySetEPKS1_[Set<Node>::CopySet(Set<Node> const*)]+0x10): undefined reference to `operator new(unsigned int)'
channelassignment.cpp:(.text._ZN3SetI4NodeE7CopySetEPKS1_[Set<Node>::CopySet(Set<Node> const*)]+0x62): undefined reference to `operator delete(void*)'
/tmp/ccLvTU1V.o: In function `Set<double>::Set()':
channelassignment.cpp:(.text._ZN3SetIdEC2Ev[_ZN3SetIdEC5Ev]+0x22): undefined reference to `operator new(unsigned int)'
/tmp/ccLvTU1V.o: In function `Set<Node>::remove(Node const&)':
channelassignment.cpp:(.text._ZN3SetI4NodeE6removeERKS0_[Set<Node>::remove(Node const&)]+0x4b): undefined reference to `operator delete(void*)'
/tmp/ccLvTU1V.o: In function `Set<Channel>::insert(Channel const&, SetItr<Channel> const&)':
channelassignment.cpp:(.text._ZN3SetI7ChannelE6insertERKS0_RK6SetItrIS0_E[Set<Channel>::insert(Channel const&, SetItr<Channel> const&)]+0x18): undefined reference to `operator new(unsigned int)'
/tmp/ccLvTU1V.o: In function `Set<Channel>::remove(Channel const&)':
channelassignment.cpp:(.text._ZN3SetI7ChannelE6removeERKS0_[Set<Channel>::remove(Channel const&)]+0x4b): undefined reference to `operator delete(void*)'
/tmp/ccLvTU1V.o: In function `Set<Node>::insert(Node const&, SetItr<Node> const&)':
channelassignment.cpp:(.text._ZN3SetI4NodeE6insertERKS0_RK6SetItrIS0_E[Set<Node>::insert(Node const&, SetItr<Node> const&)]+0x18): undefined reference to `operator new(unsigned int)'
/tmp/ccLvTU1V.o:(.eh_frame+0x6b): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status


Can anyone help me out. I want to do some silmulations in OMNeT++; I am unable. Please help me out.
Posted
Updated 30-Jun-18 11:38am
Comments
Richard MacCutchan 9-Oct-11 3:30am    
Looks like you have some system libraries missing, or the linker cannot find the path to your libraries.
Sergey Alexandrovich Kryukov 10-Oct-11 15:43pm    
Probably.
--SA
Richard MacCutchan 10-Oct-11 16:50pm    
Or maybe -c option not specified.
Member 2253416 13-Feb-12 12:10pm    
hi qasim

can you please share you channel assignment code?

1 solution

in linux to compile cpp:

1) use g++ channelassignment.cpp,
on successful compilation,
./a.out will execute.

2) g++ -o channelassignment channelassignment.cpp to get an executable of the same name i.e
./channelassignment


hope it helps!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900