无法在linux中编译 [英] Cannot compile in linux

查看:80
本文介绍了无法在linux中编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在linux中编译一个文件。当我在MS visual studio(windows)中编译它时,它工作得很好但是当我尝试通过发出命令在linux中编译时:

gcc channelassignment.cpp我得到以下错误... < br $>


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...

/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





任何人都可以帮助我。我想在OMNeT ++中做一些蠢事;我无能为力请帮帮我。



Can anyone help me out. I want to do some silmulations in OMNeT++; I am unable. Please help me out.

推荐答案

在linux下编译cpp:



1)使用g ++ channelassignment。 cpp,

成功编译,

./a.out将执行。



2)g ++ - o channelassignment channelassignment.cpp获取同名的可执行文件,即

./channelassignment





hope它有帮助!
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!


这篇关于无法在linux中编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆