User forums > Help
[solved] G++ No input files...
(1/1)
ravenshade:
Excuse me while I go bang my head up a wall because today is not my day and everything is going wrong. While trying to debug my program or figure out how it works an error came up. (See my other thread). Unfortunately trying to compile the lesson before it, not only will the program I was trying to compile work but now, a program that 'DID' compile, won't.
So here's the code for it.
--- Code: ---#ifdef __cplusplus
#include <cstdlib>
#else
#include <stdlib.h>
#endif
#ifdef __APPLE__
#include <SDL/SDL.h>
#else
#include <SDL.h>
#endif
#include <string>
//The attributes of the screen
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;
//The surfaces that will be used
SDL_Surface *message = NULL;
SDL_Surface *background = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *load_image( std::string filename )
{
//Temporary storage for the image that's loaded
SDL_Surface *loadedImage = NULL;
//The optimized image that will be used
SDL_Surface *optimizedImage = NULL;
//Load the image
loadedImage = SDL_LoadBMP(filename.c_str());
//If nothing went wrong in loading the image
if( loadedImage != NULL )
{
//Create an optimized image
optimizedImage = SDL_DisplayFormat(loadedImage );
//Free the old image
SDL_FreeSurface(loadedImage );
}
//Return the optimized image
return optimizedImage;
}
void apply_surface( int x, int y, SDL_Surface *source, SDL_Surface *destination )
{
//Make a temporary rectangle to hold the offsets
SDL_Rect offset;
//Give the offsets to the rectangle
offset.x = x;
offset.y = y;
//Blit the surface
SDL_BlitSurface( source, NULL, destination, &offset );
}
int main ( int argc, char *args[] )
{
//Initialize all SDL subsystems
if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
{
return 1;
}
//Set up the screen
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
//If there was an error in setting up the screen
if( screen == NULL )
{
return 1;
}
//Set the window caption
SDL_WM_SetCaption( "Hello World", NULL );
//Load the images
message = load_image( "Images/message01.bmp" );
background = load_image( "Images/background.bmp" );
//Apply the background to the screen
apply_surface( 0, 0, background, screen );
return 0;
}
--- End code ---
and here's the compile.
--- Code: ----------------- Build: Debug in sdl_layer_images_app ---------------
g++ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Wall -g 'sdl-config --cflags' 'sdl-config --libs' -c "/home/ravenshade/Documents/cpp programs/sdl_layer_images_app/main.cpp" -o obj/Debug/main.o
g++: no input files
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
--- End code ---
Why would a program compile one day and not the next. I hadn't even restarted my computer, I simply accessed it again. I have a feeling something has decided to disappear on me or some setting has become dislodged.
ravenshade:
Removed --lib and what not from my compiler other settings.
oBFusCATed:
Replace ' with ` (the button on the left side of 1). ` is called a backtick.
ravenshade:
Yeah but surprisingly I didn't have to. It all works now since I removed --libs and --cflags. Well what I mean by 'it all works' is that the G++ issue doesn't come up. I resolved my other problem as well ^-^
Thanks anyway.
Navigation
[0] Message Index
Go to full version