
在VC编译成功的C++文件,在linux中怎么会出现这样的错误??
[root@localhostshujujiegou]#g++TestPolynomal.cpp-oTestPolynomalInfileincludedfrom/usr...
[root@localhost shujujiegou]# g++ TestPolynomal.cpp -o TestPolynomal
In file included from /usr/lib/gcc/i386-redhat-linux/3.4.5/../../../../include/c++/3.4.5/backward/iostream.h:31,
from Polynomal.h:4,
from TestPolynomal.cpp:2:
/usr/lib/gcc/i386-redhat-linux/3.4.5/../../../../include/c++/3.4.5/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
TestPolynomal.cpp: In function `int main()':
TestPolynomal.cpp:14: error: no matching function for call to `Polynomal::Polynomal(Polynomal)'
Polynomal.h:56: note: candidates are: Polynomal::Polynomal(Polynomal&)
TestPolynomal.cpp:17: error: no matching function for call to `Polynomal::Polynomal(Polynomal)'
Polynomal.h:56: note: candidates are: Polynomal::Polynomal(Polynomal&)
[root@localhost shujujiegou]#
答案越详细越好,包括如何修改 展开
In file included from /usr/lib/gcc/i386-redhat-linux/3.4.5/../../../../include/c++/3.4.5/backward/iostream.h:31,
from Polynomal.h:4,
from TestPolynomal.cpp:2:
/usr/lib/gcc/i386-redhat-linux/3.4.5/../../../../include/c++/3.4.5/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
TestPolynomal.cpp: In function `int main()':
TestPolynomal.cpp:14: error: no matching function for call to `Polynomal::Polynomal(Polynomal)'
Polynomal.h:56: note: candidates are: Polynomal::Polynomal(Polynomal&)
TestPolynomal.cpp:17: error: no matching function for call to `Polynomal::Polynomal(Polynomal)'
Polynomal.h:56: note: candidates are: Polynomal::Polynomal(Polynomal&)
[root@localhost shujujiegou]#
答案越详细越好,包括如何修改 展开
3个回答
展开全部
你的C++源代码中应该有VC自动创建的类, 这个是不兼容于ANSI C标准的,
基本上, VC下的工程转移到linux平台都要经过一些移植 好了 不说废话
C++中头文件的标准写法是 #include <iostream>
如果写成xx.h,则会出现warning报告,C++标准中有说明;
在Polynomal类中的构造函数,声明与定义不一致,
头文件中声明为:Polynomal::(Polynomal&)
但在.cpp中定义为Polynomal::(Polynomal)
形参不一样而造成出错
基本上, VC下的工程转移到linux平台都要经过一些移植 好了 不说废话
C++中头文件的标准写法是 #include <iostream>
如果写成xx.h,则会出现warning报告,C++标准中有说明;
在Polynomal类中的构造函数,声明与定义不一致,
头文件中声明为:Polynomal::(Polynomal&)
但在.cpp中定义为Polynomal::(Polynomal)
形参不一样而造成出错
展开全部
VC++ 的 C 代码和 GCC 的代码不兼容。
需要进行代码移植。
需要进行代码移植。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
no matching function for call to `Polynomal::Polynomal(Polynomal)'
candidates are: Polynomal::Polynomal(Polynomal&)
candidates are: Polynomal::Polynomal(Polynomal&)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询