Compiling Project Problemos

This is a discussion on Compiling Project Problemos within the Windows Programming forums, part of the Platform Specific Boards category; Trying to develop a simple outline for a game engine.. This program is simply supposed to populate a window with ...

  1. #1
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Question Compiling Project Problemos

    Trying to develop a simple outline for a game engine.. This program is simply supposed to populate a window with a bunch of skeleton icons. This is my first time trying to include resources into my program so I'm not sure if I'm doing it right.

    My Project:

    GameEngine.h
    GameEngine.cpp
    GameEngineDriver.cpp
    Skeleton.h <----Suspected error here.. but it's just like out the book
    Skeleton.cpp
    Resource.h
    Resource.rc


    Skeleton.h
    Code:
    #pragma once
    
    #include <windows.h>
    #include "Resource.h"
    #include "GameEngine.h"
    
    //Globals
    GameEngine* _pGame;


    Dev-Cpp errors:

    Compiler: Default compiler
    Building Makefile: "F:\Dev-Cpp\Makefile.win"
    Executing make clean
    rm -f GameEngineDriver.o GameEngine.o Skeleton.o Skeleton_private.res Skeleton.exe

    g++.exe -c GameEngineDriver.cpp -o GameEngineDriver.o -I"F:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"F:/Dev-Cpp/include/c++/3.4.2/backward" -I"F:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"F:/Dev-Cpp/include/c++/3.4.2" -I"F:/Dev-Cpp/include"

    GameEngineDriver.cpp: In function `int WinMain(HINSTANCE__*, HINSTANCE__*, CHAR*, int)':
    GameEngineDriver.cpp:13: error: `GameInitialize' undeclared (first use this function)
    GameEngineDriver.cpp:13: error: (Each undeclared identifier is reported only once for each function it appears in.)

    GameEngineDriver.cpp:43: error: 'class GameEngine' has no member named 'GetFrameDelay'
    GameEngineDriver.cpp:44: error: `GameCycle' undeclared (first use this function)
    GameEngineDriver.cpp:54: error: `GameEnd' undeclared (first use this function)

    make.exe: *** [GameEngineDriver.o] Error 1

    Execution terminated



    It seems like my project is not responding to the skeleton class.. which is where all the above functions are defined. Can anyone else get this code to compile..?? I think that if I can get a program like this to work.. I will have an easier time in getting future windows projects to compile.

    I'm also not clear about GameEngineDriver.cpp (GameEngineDriver.cpp is my own addition to the program to facilitate the need for a WinMain( )) In the book, HandleEvent( ) is functionally defined, but never called. This is where I think it should go:

    GameEngineDriver.cpp: excerpts
    Code:
    //I think this:
         
          return (int)msg.wParam;
    
    //should be this:
    
         GameEngine::HandleEvent(hWindow, msg, wParam, lParam)
    Attached Images Attached Images  
    Last edited by The Brain; 06-14-2005 at 08:01 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  2. #2
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Screw the book.. made my own Skeleton.h:

    Code:
    #include <windows.h>
    using namespace std;
    
    #pragma once
    
    #include <windows.h>
    #include "Resource.h"
    #include "GameEngine.h"
    
          //Skeleton.cpp Function Prototypes
          BOOL GameInitialize(HINSTANCE hInstance);
          void GameStart(HWND hWindow);
          void GameEnd();
          void GameActivate(HWND hWindow);
          void GameDeactivate(HWND hWindow);
          void GamePaint(HDC hDC);
          void GameCycle();              
         
          //Globals
          GameEngine* _pGame;

    Now.. I am just down to one error.. a resource error.. Not sure how to go about this.. I made a couple of icons in ms paint.. made a large icon 32x32 of a skull with crossbones.. and a 16x16 small icon of just a head. I saved them as .ico files... but I still get this error:

    Dev-Cpp
    windres.exe: icon file `Skeleton.bmp' does not contain icon data
    make.exe: *** [Skeleton_private.res] Error 1
    Execution terminated


    and.. when trying to open the resource file.. I get a, "error RC2175: resource file Skeleton.h ico is not in 3.00 format " error.
    Attached Images Attached Images  
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  3. #3
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    You mean you were in Paint and just clicked Save As and put .ico at the end? If so, that doesn't work. Just because you put the right extension at the end, doesn't always mean that it will contain the proper data. The data for .bmp and .ico, as with almost all extensions, will be stored differently. Your program has to have the proper capabilities to save files in that format, and unfortunately, Paint doesn't meet these needs. If data isn't in the right format, your computer may try to read the information about the size of the image and paint pixels with it. Of course, in this case, Dev-C++ can tell in advance that it's not the right formay. Search the internet for a Resource Editor. Personally, I use a program called PE Resource Editor. It's a tad confusing at first, but you can use it to make .ico files and all kinds of others.

    If that's not the problem, then I don't have a clue.
    Last edited by Jaken Veina; 06-14-2005 at 12:02 PM.

  4. #4
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Got PE Resource Editor. Made a couple of icons. Thew them into the Dev-Cpp folder. Tried to compile project.. get same errors:

    F:\Dev-Cpp\Makefile.win [Build Error] [Skeleton_private.res] Error 1

    icon file `Skeleton.ico' does not contain icon data

    resource file Skeleton.h ico is not in 3.00 format


    I think I am on the right track.. but I must be overlooking something... Tried compiling with MSVC++ 6.0 but got the same error (below)
    Attached Images Attached Images  
    Last edited by The Brain; 06-16-2005 at 08:28 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  5. #5
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Well, I spent 20 minutes copy-and-pasting your files into Dev-C++ to replicate the project (I got a bunch of errors, anyway), and then I noticed something.

    Resource.h
    Code:
      #define IDI_SKELETON        1000
      #define IDI_SKELETON_SM     1001
    Resource,rc
    Code:
      #include "Resource.h"
    
      IDI_SKELETON  ICON   "Skeleton.ico"
      IDI_SKELETON  ICON   "Skeleton_sm.ico"
    I believe all your grief is cause by a typo on the small icon, in the .rc. You missed the _SM tag at the end.
    Last edited by Jaken Veina; 06-16-2005 at 10:30 PM.

  6. #6
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Code:
    _pGame = new GameEngine(hInstance, TEXT("Game Skeleton"), 
                            TEXT("Game Skeleton", IDI_SKELETON, //Error on this one
                            IDI_SKELETON_SM);

    I've fixed this.. I forgot to put a closing ) at the end of my text macro

    I think that will eliminate all the syntax erorrs..

    I'll email you my icons.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  7. #7
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Nevermind. I edited my post. Check it out.

    EDIT: Nevermind neverminding. An error I thought was THE error, you must have fixed, because it's fixed in the screenshot. I'll keep looking.

    Got another error, you probably fixed already.
    Code:
      DrawIcon(hDC, rand()%_pGame->GetWidth(), rand()%_pGame->GetHeight(), 
               (HICON)(WORD)GetClassLong(hWindow, GCL_HICON)); //Error here.
    Code:
    [Warning] cast to pointer from integer of different size
    And for some reason.....
    Code:
    multiple definition of `_pGame'
    Last edited by Jaken Veina; 06-16-2005 at 11:22 PM.

  8. #8
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    I noticed that IDI_Skeleton / IDI_Skeleton_sm error too

    The DrawIcon( ) function only gives me a warning (casting an object to a larger size) or something.. but for now if it gives you any compile errors.. feel free to comment it out for now. (right now, just try mainly to get anything to compile with resources).

    *Don't have a multiple redefinition error
    Last edited by The Brain; 06-18-2005 at 06:14 AM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  9. #9
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Well, if I comment that out, I still get the multiple definition warning, except there's no listed line number. Did you never come across that.

    And I returned your e-mail. Might have found a problem.
    Code:
    void function(void)
     {
      function();
     }

  10. #10
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Yep. Probably a problem. I should have mentioned it before, but PE Resource Editor is very tricky when it comes to icons. You can't use the Save As option, since it doesn't offer a .ico extension there. And you can't save as .res and change to .ico, like you did. Here's what I do.

    First, I make the picture myself in Paint and save it. Next, I open up PE and select "Import Image Resource" from the "Resource" menu. Of course, I import my picture I just created. Then, I select "Add Resource" also under the "Resource" menu and make it an "Icon Group." Now, I go into my bitmap picture, select the "Drawing Tools" tab over on the right. I use the selection tool, select the entire image, and copy it. I go to the Icon I created and make sure it's the right size, then I simply paste the image into it. Now, you still can't use Save As. You have to have the Icon on the screen and select "Export Resource" from the "Resource" menu. There, you can save it as a .ico.
    Code:
    void function(void)
     {
      function();
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 01:12 AM
  2. Project Varia recruiting.
    By Raigne in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 10-12-2008, 03:15 PM
  3. HELP! 1st Project!
    By Zionstorm in forum C++ Programming
    Replies: 3
    Last Post: 09-15-2008, 09:36 AM
  4. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM
  5. Compiling assembly code into project
    By knutso in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 02:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21