Author Topic: [solved] G++ No input files...  (Read 11912 times)

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
[solved] G++ No input files...
« on: August 08, 2011, 02:48:36 pm »
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;
}

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

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.
 
« Last Edit: August 08, 2011, 08:45:46 pm by ravenshade »

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: G++ No input files...[solved]
« Reply #1 on: August 08, 2011, 02:55:09 pm »
Removed --lib and what not from my compiler other settings.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: G++ No input files...
« Reply #2 on: August 08, 2011, 03:28:50 pm »
Replace ' with ` (the button on the left side of 1). ` is called a backtick.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ravenshade

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: G++ No input files...
« Reply #3 on: August 08, 2011, 04:56:00 pm »
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.