gcc v2.95.3 - > VS [英] gcc v2.95.3 --> VS

查看:55
本文介绍了gcc v2.95.3 - > VS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello people,

我用GNU编译器gcc版本2.95.3编译的C ++代码。

我需要在windows下编辑和运行。 (我可以访问VS6和

VS.NET)


什么方法更容易?

1)重写它?

2)添加函数以使原始代码有意义吗?


例如,以下行生成错误:


vector< pair< int,int> > abc;

map< int,vector< int> > xyz;


谢谢

解决方案

pl *** @ letsdothatagain.com 写道:

大家好,我有用GNU编译器编译的C ++代码gcc版本2.95.3。
我需要在windows下编辑和运行。 (我可以访问VS6和VS.NET)

什么方法更容易?
1)重写它?
2)添加函数使原代码有意义吗?

例如,以下行生成错误:

vector< pair< int,int> > abc;
map< int,vector< int> > xyz;

谢谢




plize:


什么错误?是什么让你认为这个

代码有问题?除了可能缺少标题或std名称空间。


一般来说,VS2003.NET(可能还有VC6)比gcc更好的编译器

2.95,所以你不应该如果你的代码是正确的C ++会有问题。

不要相信VC编译器糟糕的Linux宣传;每个VC

编译器(除了VS2002)在

发布时一直处于领先地位。


David Wilkinson


>大家好,

我有用GNU编译器gcc版本2.95.3编译的C ++代码。
我需要在windows下编辑和运行。 (我可以访问VS6和VS.NET)

什么方法更容易?
1)重写它?
2)添加函数使原代码有意义吗?




添加到David的回复:

最近我不得不将一个相当复杂的命令行应用程序从linux移植到

windows。

在linux上他们使用gcc 2.95,在windows上我使用的是VC2003。


因为它是一个控制台风格的应用程序使用99%ANSI C ++,移植它是相当无痛的



有一些不同的东西,例如构建文件路径或

类似的事情。


唯一的障碍是原始程序员使用readome

函数从输入文件流中读取数据。事实证明,该特定情况下的

行为在标准中未定义。 gcc做了一个

的事情,vc另一个。


移植应用程序并根据已知数据对其进行测试仅需1天。

所以我认为你应该在不选择重写的情况下尝试移植它。


你的问题没有明确的答案。

基本上它一切都取决于所使用的技术。如果可以移动到

windows那么你应该好好去。


-


亲切的问候,

Bruno van Dooren
br ********************** @ hotmail.com

仅删除_nos_pam


好吧,我很高兴我的''问题'可以轻松解决。

它接缝IOSTREAM是缺失的链接。

使用VS.Net 1.1(Visual C ++)时出现以下错误:


#include< iostream.h>

ABC致命错误C1083:无法打开包含文件:''iostream.h'':否

这样的文件或目录


int BinarySearch(vector< int> aVector,int n);

ABC错误C2062:输入''int''意外

Path :: Path(istream& is){

ABC错误C2065:''是'':未声明的标识符


vector< int>另一个向量;

ABC错误C2143:语法错误:在''之前缺少'';''<'''

ABC错误C2501:''Prog :: vector'' :缺少存储类或类型

说明符


Hello people,
I have C++ code compiled with GNU compiler gcc version 2.95.3.
which I need to edit and run under windows. (I have access to VS6 and
VS.NET)

What approach is easier?
1) Rewrite it?
2) Add functions so that the original code makes sense?

For example, the following line generates an error:

vector<pair<int, int> > abc;
map<int, vector<int> > xyz;

Thank you

解决方案

pl***@letsdothatagain.com wrote:

Hello people,
I have C++ code compiled with GNU compiler gcc version 2.95.3.
which I need to edit and run under windows. (I have access to VS6 and
VS.NET)

What approach is easier?
1) Rewrite it?
2) Add functions so that the original code makes sense?

For example, the following line generates an error:

vector<pair<int, int> > abc;
map<int, vector<int> > xyz;

Thank you



plize:

What error? What makes you think there is something wrong with this
code? Except perhaps missing header or std namespace.

In general, VS2003.NET (and probably VC6) are better compilers than gcc
2.95, so you should not be having problems if your code is correct C++.
Don''t believe the Linux propaganda that VC compilers are bad; every VC
compiler (except perhaps VS2002) has been cutting edge at the time of
release.

David Wilkinson


> Hello people,

I have C++ code compiled with GNU compiler gcc version 2.95.3.
which I need to edit and run under windows. (I have access to VS6 and
VS.NET)

What approach is easier?
1) Rewrite it?
2) Add functions so that the original code makes sense?



To add to David''s reply:
Recently I had to port a reasonably complex commandline app from linux to
windows.
on linux they used gcc 2.95, on windows I used VC2003.

since it was a console style app that used 99 % ANSI C++, Porting it was
fairly painless.
there were a few things different, for example building a file path or
things like that.

The only bump in the road was that the original programmer used the readsome
function to read data from an input file stream. it turned out that the
behavior in that specific case was undefined in the standard. gcc did one
thing, vc another.

To port the app and test it against known data cost me just 1 day.
So i think you should definitly try to port it without opting for a rewrite.

there is no clear cut answer to your question.
Basically it all depends on the technology used. if that is portable to
windows then you should be good to go.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"


Well, I am glad my ''problem'' can be solved that easily.
It seams IOSTREAM is the missing link.
I got the following errors when using VS.Net 1.1 (Visual C++) :

#include <iostream.h>
ABC fatal error C1083: Cannot open include file: ''iostream.h'': No
such file or directory

int BinarySearch(vector<int> aVector, int n );
ABC error C2062: type ''int'' unexpected

Path::Path( istream& is ) {
ABC error C2065: ''is'' : undeclared identifier

vector<int> anotherVector;
ABC error C2143: syntax error : missing '';'' before ''<''
ABC error C2501: ''Prog::vector'' : missing storage-class or type
specifiers


这篇关于gcc v2.95.3 - &gt; VS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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