杂散" \26"在程序中 [英] stray"\26" in program
问题描述
嗨
我的Dev C ++项目中有Main.cpp和Hello.cpp文件。
Main.cpp >
#include" Hello.cpp"
int main(){
返回0;
}
Hello.cpp
#include< stdio.h>
int main(){
printf(" Hello World!");
getchar();
返回0;
}
? //这会上升错误
我的问题是:假设我无法修改Hello.cpp。我该怎么做才能使编译器忽略Hello.cpp文件末尾的方块?
Regrads
Grzesiek Wilanowski
Hi
I have Main.cpp and Hello.cpp files in my Dev C++ project.
Main.cpp
#include "Hello.cpp"
int main(){
return 0;
}
Hello.cpp
#include<stdio.h>
int main(){
printf("Hello World!");
getchar();
return 0;
}
//this rises error
My question is: Suppose i cant modify Hello.cpp. What can i do to make
the compiler to ignore the square at the end of Hello.cpp file?
Regrads
Grzesiek Wilanowski
推荐答案
7月3日上午10:02,Grzesiek< grzesiek.wilanow ... @ gmail.comwrote:
On Jul 3, 10:02 am, Grzesiek <grzesiek.wilanow...@gmail.comwrote:
嗨
我的Dev C ++项目中有Main.cpp和Hello.cpp文件。< br $>
Main.cpp
#include" Hello.cpp"
Hi
I have Main.cpp and Hello.cpp files in my Dev C++ project.
Main.cpp
#include "Hello.cpp"
在另一个源文件中包含源文件是一个非常糟糕的主意。
Including a source file in another source file is a *very* bad idea.
>
int main(){
返回0;
>
int main(){
return 0;
严格来说,不需要返回0。
Strictly speaking, return 0 is not necessary.
>
}
Hello.cpp
#include< stdio.h>
>
}
Hello.cpp
#include<stdio.h>
在C ++文件中,建议选择< ctsdioinstead of< stdio.h>
In a C++ File, it is advised to prefer <ctsdioinstead of <stdio.h>
int main(){
int main(){
你最终将得到*两个*main的定义;。编译器不会接受这个
。
You will end up with *two* definitions of "main". Compiler will not
accept this.
printf(" Hello World!");
getchar();
返回0; }
//这个上升错误
printf("Hello World!");
getchar();
return 0;}
//this rises error
这个上升的错误是什么?
What error does this rise?
>
我的问题是:假设我无法修改Hello.cpp。我该怎么做才能使编译器忽略Hello.cpp文件末尾的方块?
>
My question is: Suppose i cant modify Hello.cpp. What can i do to make
the compiler to ignore the square at the end of Hello.cpp file?
什么方格?
What square?
Regrads
Grzesiek Wilanowski
Regrads
Grzesiek Wilanowski
-Neelesh
-Neelesh
谢谢Neelesh,但不是这里的情况。
我会这样说的。这是一个Hello.cpp文件
#include< stdio.h>
int main(){
printf(Hello World!);
getchar();
返回0;
}
x //这个上升错误
假设我无法修改Hello.cpp文件,这意味着我无法删除流浪
x。
然后我想将Hello.cpp文件包含到任何其他文件中,让我们调用
它Test.cpp。我应该在Test.cpp中添加什么代码来使编译器
忽略Hello.cpp文件中的stray x?
这是我遇到的问题尝试使用遗传算法
图书馆
http:/ /lancet.mit.edu/ga/
我的开发C ++项目中的
在GA库中,evry文件有一个char''?' '(而不是上面的样本中的x
上面的
程序)并且在程序结束时出现stray \26
错误。
Grzesiek
On 3 Lip,07:16,Neelesh Bodas< neelesh.bo ... @ gmail.comwrote:
Thanks Neelesh, but its not the case here.
I will put it that way. Here is a Hello.cpp file
#include<stdio.h>
int main(){
printf("Hello World!");
getchar();
return 0;
}
x // this rises error
Suppose i cant modify Hello.cpp file, that means i cant remove stray
x.
Then i want to include Hello.cpp file into any other file, lets call
it Test.cpp. What code should i add to Test.cpp to make the compiler
to ignore stray x in Hello.cpp file?
This is a problem i came across trying to use Genetic Algorithms
Library
http://lancet.mit.edu/ga/
in my Dev C++ project
In GA library evry file has a char ''''(instead of x in the sample
program above) at the end of it and that rises "stray \26 in program"
error.
Grzesiek
On 3 Lip, 07:16, Neelesh Bodas <neelesh.bo...@gmail.comwrote:
7月3日上午10:02,Grzesiek< grzesiek.wilanow ... @ gmail.comwrote:
On Jul 3, 10:02 am, Grzesiek <grzesiek.wilanow...@gmail.comwrote:
Hi
Hi
我的Dev C ++项目中有Main.cpp和Hello.cpp文件。
I have Main.cpp and Hello.cpp files in my Dev C++ project.
Main.cpp
Main.cpp
#include" Hello.cpp" ;
#include "Hello.cpp"
在另一个源文件中包含源文件是一个非常糟糕的主意。
Including a source file in another source file is a *very* bad idea.
int main (){
返回0;
int main(){
return 0;
严格来说,不需要返回0。
Strictly speaking, return 0 is not necessary.
}
}
Hello.cpp
Hello.cpp
#include< stdio.h>
#include<stdio.h>
在C ++文件中,建议首选< ctsdioinstead< stdio.h>
In a C++ File, it is advised to prefer <ctsdioinstead of <stdio.h>
int main(){
int main(){
你最终将得到* main的两个*定义。编译器不会接受这个。
You will end up with *two* definitions of "main". Compiler will not
accept this.
printf(" Hello World!");
getchar ();
返回0;}
printf("Hello World!");
getchar();
return 0;}
//这会上升错误
//this rises error
这会出现什么错误?
What error does this rise?
我的问题是:假设我无法修改Hello.cpp。我该怎么做才能使编译器忽略Hello.cpp文件末尾的方块?
My question is: Suppose i cant modify Hello.cpp. What can i do to make
the compiler to ignore the square at the end of Hello.cpp file?
什么方格?
What square?
Regrads
Regrads
Grzesiek Wilanowski
Grzesiek Wilanowski
-Neelesh
-Neelesh
Grzesiek写道:
Grzesiek wrote:
谢谢Neelesh,但不是这里的情况。
我会这样说的。这是一个Hello.cpp文件
#include< stdio.h>
int main(){
printf(Hello World!);
getchar();
返回0;
}
x //这个上升错误
假设我无法修改Hello.cpp文件,这意味着我无法删除流浪
x。
然后我想将Hello.cpp文件包含到任何其他文件中,让我们调用
它Test.cpp。我应该在Test.cpp中添加什么代码来使编译器
忽略Hello.cpp文件中的stray x?
这是我遇到的问题尝试使用遗传算法
图书馆
http:/ /lancet.mit.edu/ga/
我的开发C ++项目中的
在GA库中,evry文件有一个char''?' '(而不是上面的样本中的x
上面的
程序)并且在程序中上升stray \26
e
Thanks Neelesh, but its not the case here.
I will put it that way. Here is a Hello.cpp file
#include<stdio.h>
int main(){
printf("Hello World!");
getchar();
return 0;
}
x // this rises error
Suppose i cant modify Hello.cpp file, that means i cant remove stray
x.
Then i want to include Hello.cpp file into any other file, lets call
it Test.cpp. What code should i add to Test.cpp to make the compiler
to ignore stray x in Hello.cpp file?
This is a problem i came across trying to use Genetic Algorithms
Library
http://lancet.mit.edu/ga/
in my Dev C++ project
In GA library evry file has a char ''''(instead of x in the sample
program above) at the end of it and that rises "stray \26 in program"
e
为什么你不允许修改源代码?然后将hello.cpp复制到
myhello.cpp并编辑它。
Why aren''t you allowed to modify source? Then copy hello.cpp to
myhello.cpp and edit that.
这篇关于杂散" \26"在程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!