Hello you guys. I'm very excited since I'm so close to finishing my project. However before I'm totally done I am kind of stuck on this error message when compiling. It says "cannot find -lobjc." Have anyone seen this before? What does it mean? I've added my entire code if you want to look it through see below.

This is in the Engine source file. "Engine.cpp"

//This here contains the definition of the class member functions
#include "Engine.h"

//Constructor
EngineBlock::EngineBlock(HINSTANCE hinstance, LPSTR szwinclassname, LPSTR szwintitle, WORD wicon, WORD wiconsm, int iwidth, int iheight)
{
  //When called the constructor will initiate these member values
  cm_pEngine = &cm_cEngine;
  cm_handinst = hinstance;
  cm_winhandle = NULL;
  if(lstrlen(szwinclassname)>0)
  {
    lstrcpy(cm_szWinClassName, szwinclassname);
  }
  if(lstrlen(szwintitle)>0)
  {
    lstrcpy(cm_szWinTitle, szwintitle);
  }
  cm_wicon = wicon;
  cm_wiconsm = wiconsm;
  cm_iwidth = iwidth;
  cm_iheight = iheight;
}

EngineBlock::~EngineBlock()
{
}

bool EngineBlock::IgniteEngine(int ishow)
{
  AppWinClass.cbSize = sizeof(AppWinClass);
  AppWinClass.cbClsExtra = 0;
  AppWinClass.cbWndExtra = 0;
  AppWinClass.style = CS_HREDRAW | CS_VREDRAW;
  AppWinClass.lpfnWndProc = t1f_winproc;
  AppWinClass.hInstance = cm_handinst;
  AppWinClass.lpszMenuName = NULL;
  AppWinClass.lpszClassName = cm_szWinClassName;
  AppWinClass.hCursor = LoadCursor(NULL, IDC_ARROW);
  AppWinClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  AppWinClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
  AppWinClass.hbrBackground = (HBRUSH)(BLACK_BRUSH);

  if(!RegisterClassEx(&AppWinClass))
  {
    return false;
  }

  cm_winhandle = CreateWindow(cm_szWinClassName, cm_szWinTitle, WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, cm_handinst, NULL);

  if(!cm_winhandle)
  {
    return false;
  }

  //Show and updates window
  ShowWindow(cm_winhandle, ishow);
  UpdateWindow(cm_winhandle);

  return true;
}

LRESULT CALLBACK EngineBlock::FCUnit(HWND winhando, UINT umessage, WPARAM upperparam, LPARAM lowerparam)
{
  switch(umessage)
  {
    case WM_CREATE:
      //Displays the application window and enters the loop
      LinkFrames(winhando);
      EngineGo(winhando);
      return 0;

    case WM_PAINT:
      HDC hdc;
      PAINTSTRUCT ps;
      hdc = BeginPaint(winhando, &ps);

      //Paints the application window on screen. Later it will be on buffer then screened
      EngineRefill(hdc);

      EndPaint(winhando, &ps);
      return 0;

    case WM_DESTROY:
      //Terminates the program
      EngineOff();
      PostQuitMessage(0);
      return 0;
  }
}

This is in the "Engine.h" header file.

//Includes
#include <windows.h>
#include <windowsx.h>
#include <stdlib.h>

//Prototype for Window procedure
LRESULT CALLBACK t1f_winproc(HWND winhandle, UINT umessage, WPARAM upperparam, LPARAM lowerparam);

//WinMain prototype
int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hprevi, LPSTR szcmd, int ishow);

//Main function prototypes
bool EngineOn(HINSTANCE hinstance);
void EngineGo(HWND winhando);
void EngineOff();
void EngineRefill(HDC hdc);
void EngineIterate();

//The class 'EngineBlock'
class EngineBlock
{
  protected:
  //Members accessable only by members of the same class, derived class and friends of the class.
  static EngineBlock* cm_pEngine; //pointer to a class of EngineBlock type
  static EngineBlock cm_cEngine;//the class Imade static
  WNDCLASSEX AppWinClass;
  HWND cm_winhandle;
  HINSTANCE cm_handinst;
  TCHAR cm_szWinClassName[32];
  TCHAR cm_szWinTitle[32];
  WORD cm_wicon, cm_wiconsm;
  int cm_iwidth, cm_iheight;

  public:
  //Constructors, destructurctors, and leak.
  EngineBlock(HINSTANCE hinstance, LPSTR szwinclassname, LPSTR szwintitle, WORD wicon, WORD wiconsm, int iwidth = 640, int iheight = 480);
  virtual ~EngineBlock(); //Not sure whether to use virtual or not. Still don't have enough info.

  static EngineBlock* GrabEngine(){return cm_pEngine;};//returns the address of the class
  bool IgniteEngine(int ishow);//creates and registers the window
  LRESULT CALLBACK FCUnit(HWND winhando, UINT umessage, WPARAM upperparam, LPARAM lowerparam);//this function does the work of the Window procedure

  HINSTANCE LeakInstance(){return cm_handinst;}; //Returns the instance handle
  HWND LeakHwnd(){return cm_winhandle;}; //the Window handle
  LPSTR LeakTitle(){return cm_szWinTitle;};//the Title
  WORD LeakIcon(){return cm_wicon;};//the Icon
  WORD LeakIconSm(){return cm_wiconsm;};//the Small Icon
  int LeakWidth(){return cm_iwidth;};//width of the window
  int LeakHeight(){return cm_iheight;};//height of the window
  void LinkFrames(HWND winhando){cm_winhandle = winhando;};//sets the member with the window handle
};

This is the code for Main

//Application
#include "EngineMain.h"

int APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hprevi, LPSTR szcmd, int ishow)
{
  MSG umsg;//the message container

  if(EngineOn(hinstance)) //Only when true
  {
    //Check to see initiation is successful
    if(!EngineBlock::GrabEngine()->IgniteEngine(ishow))
    {
      return false;
    }

    while(true)
    {
      if(PeekMessage(&umsg, NULL, 0, 0, PM_REMOVE))
      {
        //Execute quit when close is activated
        if(umsg.message == WM_QUIT)
        {
          break;
        }
        TranslateMessage(&umsg);//I think these don't even get
        DispatchMessage(&umsg);//to execute at all gotta find a better place for them, maybe
      }//End of Quit check
      else
      {
        EngineIterate();
      }//Else closing brace
    }//While closing brace
    return (int)umsg.wParam;
  }//Closing brace for primary if statement

  //Terminates the program
  EngineOff();

  return true;
}//Closing brace for WinMain

//Not sure if I should give it this name it throws off my rythm
LRESULT CALLBACK t1f_winproc(HWND winhandle, UINT umessage, WPARAM upperparam, LPARAM lowerparam)
{
  return EngineBlock::GrabEngine()->FCUnit(winhandle, umessage, upperparam, lowerparam);
}

//T1 functions
bool EngineOn(HINSTANCE hinstance)
{
  _pEngine = new EngineBlock(hinstance, TEXT("SUCCESS"), TEXT("Success"), IDI_APPICON, IDI_APPICONSM);

  if(_pEngine = NULL)
  {
    return false;
  }

  return true;
}

void EngineGo(HWND winhando)
{
  //Get a random seeding
  srand(GetTickCount());
}

void EngineOff()
{
  //Free all allocated memories
  delete _pEngine;
}

void EngineRefill(HDC hdc)
{
}

void EngineIterate()
{
  HDC hdc;
  HWND hwnd = _pEngine->LeakHwnd();

  hdc = GetDC(hwnd);
/*Normally this next line was commented out because it show an error I didn't want to deal with right now cause I don't have much information on it*/
  DrawIcon(hdc, rand()%_pEngine->LeakWidth(), rand()%_pEngine->LeakHeight(), (HICON)(WORD)GetClassLong(hwnd, GCL_HICON));
  ReleaseDC(hwnd, hdc);
}

That should be all for now I don't want to take too much memory??? A thousand thanks.

That error means the linker can not find a library. Check your computer file system to see if it exists. It has nothing to do with the code you posted.

objc is for Objective C (sort of like C++, only different), yet your code looks like C++ proper.

Which compiler are you using. If it's a command line compiler, paste your command line (or some compile logs if you're using an IDE).

Salem you are correct that I am using C++ syntax. The IDE I am using is Bloodshed DevC++ and Visual Studios 5 but I have to agree with AncientDragon on this one. I may have forgotten to direct the complier to where to search for my libraries. Thank you guys a billion for your help. A thousand years of good fortune to you both. Good day.

. A thousand years of good fortune to you both..

OMG! I don't want to live that long :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.