Stray Error In Dev C++

P: n/a
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 '001a'(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:
On Jul 3, 10:02 am, Grzesiek <grzesiek.wilanow..@gmail.comwrote:
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(){
return 0;

Strictly speaking, return 0 is not necessary.
}
Hello.cpp
#include<stdio.h>

In a C++ File, it is advised to prefer <ctsdioinstead of <stdio.h>
int main(){

You will end up with *two* definitions of 'main'. Compiler will not
accept this.
printf('Hello World!');
getchar();
return 0;}
//this rises error

What error does this rise?
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

-Neelesh

  1. Stray Error In Dev C Free
P: n/a
Right. I`m using Dev-Cpp, and I`m working on a game at this time in SDL
(http://libsdl.org), and I`ve come across this error:
------------------------------------------
main.c: In function `SDL_main':
main.c:140: error: stray '160' in program
main.c:140: error: stray '160' in program
main.c:140: error: stray '160' in program
main.c:140: error: stray '160' in program
make.exe: *** [main.o] Error 1
Execution terminated
------------------------------------------
Which halts my entire game development, and I`ve no idea whats wrong.
Here`s the full source:
(it`s messy, because I`ve tried to debug it a lot, ignore the commented
statements and such)
-------------------------------------------------------------------------------------------------
#include <stdio.h>
#include <SDL/SDL.h>
#include 'include/SDL_std.h'
SDL_Surface *screen;
SDL_Surface *image;
void DrawIMG(SDL_Surface *img, int x, int y, int w, int h, int x2, int
y2)
{
SDL_Rect dest;
dest.x = x;
dest.y = y;
SDL_Rect dest2;
dest2.x = x2;
dest2.y = y2;
dest2.w = w;
dest2.h = h;
SDL_BlitSurface(img, &dest2, screen, &dest);
}
void patchbg(int x, int y)
{
DrawIMG(image, 0, 0, 50, 50, x-2, y-2);
}
void ShowBMP(char *file, SDL_Surface *screen, int x, int y)
{
SDL_Rect dest;
/* Load the BMP file into a surface */
image = SDL_LoadBMP(file);
if ( image NULL ) {
fprintf(stderr, 'Couldn't load %s: %sn', file,
SDL_GetError());
return;
}
/* Blit onto the screen surface.
The surfaces should not be locked at this point.
*/
dest.x = x;
dest.y = y;
dest.w = image->w;
dest.h = image->h;
SDL_BlitSurface(image, NULL, screen, &dest);
/* Update the changed portion of the screen */
SDL_UpdateRects(screen, 1, &dest);
}
void blit_mb(x, y)
{
SDL_Surface *redblock;
redblock = SDL_LoadBMP('data/meatball.bmp');
SDL_Rect source;
source.x = x;
source.y = y;
source.w = 50;
source.h = 50;
SDL_Rect destination;
destination.x = x;
destination.y = y;
destination.w = 50;
destination.h = 50;
SDL_SetColorKey(redblock,SDL_SRCCOLORKEY,SDL_MapRG B(redblock->format,255,255,255));
SDL_BlitSurface(redblock, &source, screen, &destination);
}
int main(int argc, char *argv[])
{
if ( SDL_Init(SDL_INIT_AUDIO SDL_INIT_VIDEO) < 0 )
{
printf('Unable to init SDL: %sn', SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
SDL_Surface *screen;
screen=SDL_SetVideoMode(600,600,32,SDL_SWSURFACE S DL_DOUBLEBUF);
if ( screen NULL )
{
printf('Unable to set 640x480 video: %sn', SDL_GetError());
exit(1);
}
int xpos, ypos = 0;
ShowBMP('data/logo.bmp', screen, 0, 0);
//ShowBMP('data/meatball.bmp', screen, 0, 0);
blit_mb(0, 0);
int done=0;
while(done 0)
{
SDL_Event event;
while(SDL_PollEvent(&event))
{
if(event.type SDL_QUIT)
done = 1;
if(event.type SDL_KEYDOWN)
{
if (event.key.keysym.sym SDLK_ESCAPE)
done = 1;
}
Uint8* keys;
keys = SDL_GetKeyState(NULL);
if(keys[SDLK_UP])
ypos -= 5;
if(keys[SDLK_DOWN])
ypos += 5;
if(keys[SDLK_LEFT])
xpos -= 5;
if(keys[SDLK_RIGHT])
xpos += 5;
//ShowBMP('data/meatball.bmp', screen, xpos, ypos);
blit_mb(xpos, ypos);
SDL_UpdateRect(screen, 25, 25, xpos-25, ypos-25);
//SDL_SetColorKey(image, SDL_SRCCOLORKEY, SDL_MapRGB(image->format,
255, 255, 255));
//patchbg(xpos, ypos);
//ShowBMP('data/meatball.bmp', screen, x, y);
//ShowBMP('data/logo.bmp', screen, 0, 0);
//ShowBMP('data/meatball.bmp', screen, x, y);
//SDL_Flip(screen);
}
}
return 0;
}
-------------------------------------------------------------------------------------------------
Help would me much appreciated.
Thanks.
Stray 240 in program c++

Stray Error In Dev C Free

Apr 11, 2020  Unable to compile due to scope issues on Windows in Dev-C. By JITENDER AHUJA on Sun Mar 24, 2019 04:18 AM 1. Parameters a, r, c and f are input and b is output. “a” and “b” are 2d matrices with “r” rows and “c” columns. “f” is a function pointer which can point to any function of the following type. Hi there I have a code wrote for converting feet and inches to meters and centimetres. But I'm getting a heap of errors saying 240 in program error, can any tell me what is causing this how how can I fix it? Thanks in advantaged. Aug 25, 2017  How to compile and run Dev C project. How to compile and run Dev C project. /real-guitar-vst-full-download.html. Skip navigation Sign in. HOW TO SOLVE SOURCE FILE NOT COMPLETED ERROR IN DEV C VERY EASY. The problem with stray ' 302' is that the code contains a non-break-space instead of a normal space somewhere. However fixing that, I see two additional problems which I address here. C uses the.c file extension. – emlai Mar 22 '16 at 23:52 Don't post images of text! Also C and C are different languages which happen to share some similar syntax.