简单的代码不适用于两个系统 [英] Simple code doesn't work on two systems

查看:74
本文介绍了简单的代码不适用于两个系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.NET VC ++中编写了这个非常简单的代码。我在我的系统上编译了它,并且
试图在我朋友的电脑上运行它(他没有编译器)。我们俩
都有Windows XP Professional。我有.NET framework 2.0,他有1.0,而且它没有工作;然后他安装了2.0,它仍然没有工作;所以他尝试了

2.1并且它没有工作,然后3.0并没有任何工作。我有英特尔迅驰

手机(笔记本电脑),他有英特尔奔腾4(台式电脑)。他的

系统报告了一个错误,因为配置无效的
,它无法执行程序。为什么它不起作用?


这是我写的代码,如果它意味着什么:


#include< stdlib .h>


int main(无效){

int * a;

while(1){

a =(int *)malloc(100000 * sizeof(int));

}

返回0;

}


-

世界上很容易接受世界的观点;孤独轻松

住在我们自己之后;但伟大的人就是在人群中间的人。

保持完美的甜蜜独处的孤独。

Ralph Waldo Emerson,自力更生1841年/> http://pinpoint.wordpress.com/

解决方案



" Sourcerer" < en **** @ MAKNIgmail.com写信息

news:eo ********** @ ss408.t-com.hr ...
< blockquote class =post_quotes>
>我在.NET VC ++中编写了这个非常简单的代码。我在我的系统上编译了它,并试图在我朋友的电脑上运行它(他没有编译器)。我们都有Windows XP Professional。我有.NET framework 2.0,他有1.0并且它没有工作;然后他安装了2.0,它仍然没有工作;所以
他尝试了2.1并且它没有工作,然后3.0并没有任何工作。我有英特尔迅驰移动(笔记本电脑),他有英特尔奔腾4
(台式电脑)。他的系统报告了由于配置无效而无法执行
程序的错误。为什么它不起作用?



您是否进行了发布编译? C ++中的调试编译需要调试

只在安装编译器时才会出现的库。


>

这是我写的代码,如果它意味着什么:


#include< stdlib.h>


int main( void){

int * a;

while(1){

a =(int *)malloc(100000 * sizeof(int)) ;

}

返回0;

}


-

世界上很容易接受世界的观点;很容易在我们自己的生活之后独自生活;但是伟大的人就是他在中间的人群中,只有完美的甜蜜才能保持孤独的独立性。

Ralph Waldo Emerson,自力更生1841年/> http://pinpoint.wordpress.com/


" Ben Voigt" < rb*@nospam.nospamwrote in message

news:Ok ************** @ TK2MSFTNGP03.phx.gbl ...


>

" Sourcerer" < en **** @ MAKNIgmail.com写信息

news:eo ********** @ ss408.t-com.hr ...
< blockquote class =post_quotes>
>>我在.NET VC ++中编写了这个非常简单的代码。我在我的系统上编译了它,并试图在我朋友的电脑上运行它(他没有编译器)。我们都有Windows XP Professional。我有.NET framework 2.0,他有1.0
而且它没有工作;然后他安装了2.0,它仍然没有工作;所以他用2.1尝试并且它没有工作,然后3.0并没有任何工作。我有英特尔迅驰移动(笔记本电脑),他有英特尔奔腾4(桌面电脑)。由于配置无效,他的系统报告了一个无法执行程序的错误。为什么它不起作用?



您是否进行了发布编译? C ++中的调试编译需要调试

库,这些库仅在安装编译器时出现。



你的意思是在菜单中转到Build-> Compile(或按Ctrl + F7)?我确实这么做了,但是它没有用。


-

世界上这很容易以世界舆论为生;孤独轻松

住在我们自己之后;但伟大的人就是在人群中间的人。

保持完美的甜蜜独处的孤独。

Ralph Waldo Emerson,自力更生1841年/> http://pinpoint.wordpress.com/




" Sourcerer" < en **** @ MAKNIgmail.com写信息

news:eo ********** @ ss408.t-com.hr ...
< blockquote class =post_quotes>
" Ben Voigt" < rb*@nospam.nospamwrote in message

news:Ok ************** @ TK2MSFTNGP03.phx.gbl ...


>>
" Sourcerer" < en **** @ MAKNIgmail.com写信息
新闻:eo ********** @ ss408.t-com.hr ...


>>>我在.NET VC ++中编写了这个非常简单的代码。我在我的系统上编译了它,并试图在我朋友的电脑上运行它(他没有
编译器)。我们都有Windows XP Professional。我有.NET框架
2.0,他有1.0并且它没有工作;然后他安装了2.0并且它仍然没有工作;所以他尝试了2.1并且它没有工作,然后3.0和
没有任何工作。我有Intel Centrino Mobile(笔记本电脑),而且他有Intel Pentium 4(台式电脑)。他的系统报告错误
由于配置无效而无法执行程序。为什么
不起作用?


你做了发布编译吗? C ++中的调试编译需要调试库,这些库仅在安装编译器时才存在。



你的意思是转到Build->在菜单中编译(或按Ctrl + F7)?

我做到了,但它不起作用。



我的意思是选择发布作为当前的构建配置。在你编译
之后,.exe出现在哪个目录中?如果它是一个Debug目录,

那么它就不会在没有安装编译器的任何计算机上运行。请注意,

目录名称并不重要,它只是

默认项目选项下的一个很好的指标。


构建配置显示在标准中。 Visual Studio中的工具栏

2005.


>

-

世界上很容易接受这个世界的观点;很容易在我们自己的生活之后独自生活;但是伟大的人就是他在中间的人群中,只有完美的甜蜜才能保持孤独的独立性。

Ralph Waldo Emerson,自力更生1841年/> http://pinpoint.wordpress.com/


I wrote this very simple code in .NET VC++. I compiled it on my system, and
tried to run it on my friend''s computer (he doesn''t have the compiler). We both
have Windows XP Professional. I have .NET framework 2.0, and he had 1.0 and it
didn''t work; then he installed 2.0 and it still didn''t work; so he tried with
2.1 and it didn''t work, then 3.0 and nothing still worked. I have Intel Centrino
Mobile (laptop computer), and he has Intel Pentium 4 (desktop computer). His
system reported an error that it cannot execute the program because of invalid
configuration. Why doesn''t it work?

Here is the code I wrote, if it would mean anything:

#include <stdlib.h>

int main(void) {
int *a;
while (1) {
a = (int *) malloc(100000 * sizeof(int));
}
return 0;
}

--
"It is easy in the world to live after the world''s opinion; it easy in solitude
to live after our own; but the great man is he who in the midst of the crowd
keeps with perfect sweetness the independence of solitude."
Ralph Waldo Emerson, Self-reliance 1841
http://pinpoint.wordpress.com/

解决方案


"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:eo**********@ss408.t-com.hr...

>I wrote this very simple code in .NET VC++. I compiled it on my system, and
tried to run it on my friend''s computer (he doesn''t have the compiler). We
both have Windows XP Professional. I have .NET framework 2.0, and he had
1.0 and it didn''t work; then he installed 2.0 and it still didn''t work; so
he tried with 2.1 and it didn''t work, then 3.0 and nothing still worked. I
have Intel Centrino Mobile (laptop computer), and he has Intel Pentium 4
(desktop computer). His system reported an error that it cannot execute the
program because of invalid configuration. Why doesn''t it work?

Did you do a release compile? The debug compile in C++ requires debug
libraries that are only present when the compiler is installed.

>
Here is the code I wrote, if it would mean anything:

#include <stdlib.h>

int main(void) {
int *a;
while (1) {
a = (int *) malloc(100000 * sizeof(int));
}
return 0;
}

--
"It is easy in the world to live after the world''s opinion; it easy in
solitude to live after our own; but the great man is he who in the midst
of the crowd keeps with perfect sweetness the independence of solitude."
Ralph Waldo Emerson, Self-reliance 1841
http://pinpoint.wordpress.com/



"Ben Voigt" <rb*@nospam.nospamwrote in message
news:Ok**************@TK2MSFTNGP03.phx.gbl...

>
"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:eo**********@ss408.t-com.hr...

>>I wrote this very simple code in .NET VC++. I compiled it on my system, and
tried to run it on my friend''s computer (he doesn''t have the compiler). We
both have Windows XP Professional. I have .NET framework 2.0, and he had 1.0
and it didn''t work; then he installed 2.0 and it still didn''t work; so he
tried with 2.1 and it didn''t work, then 3.0 and nothing still worked. I have
Intel Centrino Mobile (laptop computer), and he has Intel Pentium 4 (desktop
computer). His system reported an error that it cannot execute the program
because of invalid configuration. Why doesn''t it work?


Did you do a release compile? The debug compile in C++ requires debug
libraries that are only present when the compiler is installed.

Do you mean by going to Build->Compile in the menu (or pressing Ctrl+F7)? I did
that, but it doesn''t work.

--
"It is easy in the world to live after the world''s opinion; it easy in solitude
to live after our own; but the great man is he who in the midst of the crowd
keeps with perfect sweetness the independence of solitude."
Ralph Waldo Emerson, Self-reliance 1841
http://pinpoint.wordpress.com/



"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:eo**********@ss408.t-com.hr...

"Ben Voigt" <rb*@nospam.nospamwrote in message
news:Ok**************@TK2MSFTNGP03.phx.gbl...

>>
"Sourcerer" <en****@MAKNIgmail.comwrote in message
news:eo**********@ss408.t-com.hr...

>>>I wrote this very simple code in .NET VC++. I compiled it on my system,
and tried to run it on my friend''s computer (he doesn''t have the
compiler). We both have Windows XP Professional. I have .NET framework
2.0, and he had 1.0 and it didn''t work; then he installed 2.0 and it
still didn''t work; so he tried with 2.1 and it didn''t work, then 3.0 and
nothing still worked. I have Intel Centrino Mobile (laptop computer), and
he has Intel Pentium 4 (desktop computer). His system reported an error
that it cannot execute the program because of invalid configuration. Why
doesn''t it work?


Did you do a release compile? The debug compile in C++ requires debug
libraries that are only present when the compiler is installed.


Do you mean by going to Build->Compile in the menu (or pressing Ctrl+F7)?
I did that, but it doesn''t work.

I mean select "Release" as the current build configuration. After you
compile, what directory does the .exe appear in? If it''s a Debug directory,
then it won''t run on any computer without the compiler installed. Note that
the directory name isn''t what counts, it''s just a good indicator under the
default project options.

The build configuration appears on the "Standard" toolbar in Visual Studio
2005.

>
--
"It is easy in the world to live after the world''s opinion; it easy in
solitude to live after our own; but the great man is he who in the midst
of the crowd keeps with perfect sweetness the independence of solitude."
Ralph Waldo Emerson, Self-reliance 1841
http://pinpoint.wordpress.com/



这篇关于简单的代码不适用于两个系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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