linker errors

This is a discussion on linker errors within the C++ Programming forums, part of the General Programming Boards category; I've never had any experience with linker problems before. Looks like it might be the way I call some D3D ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    44

    linker errors

    I've never had any experience with linker problems before. Looks like it might be the way I call some D3D and WINAPI methods, but I checked their usage, and it looks ok. After a long debugging session I finally got my project to compile, but now I have multiple linker errors (four).

    Here's the error text:

    error LNK2019: unresolved external symbol "public: void __thiscall CApplication::CheckDeviceCaps(void)" (?CheckDeviceCaps@CApplication@@QAEXXZ) referenced in function "public: void __thiscall CApplication::InitDirect3D(void)" (?InitDirect3D@CApplication@@QAEXXZ)

    error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "public: void __thiscall CApplication::InitDirect3D(void)" (?InitDirect3D@CApplication@@QAEXXZ)

    error LNK2019: unresolved external symbol __imp__InitCommonControls@0 referenced in function "public: void __thiscall CApplication::InitWindow(void)" (?InitWindow@CApplication@@QAEXXZ)

    error LNK2019: unresolved external symbol _D3DXMatrixPerspectiveFovLH@20 referenced in function "public: void __thiscall CApplication::InitScene(void)" (?InitScene@CApplication@@QAEXXZ)

    How do I resolve problems like these?

    I realize this might be a game programming question, but because the errors were reported by my c++ compiler I thought this would be the appropriate place to post my problem.
    Check out all my dimensions:
    Height, width, and for a limited time only... Depth!
    -sb

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Do you have the code written for those functions, and is it included in the project?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Also make sure all the correct libs are included in your project...
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Question Man. linker errors are tough!

    What seems weird to me is the word "void". Maybe it "thinks" the function prototype is a function call???

    How does it know it's a void, if it can't find the function??? Or, maybe they aren't supposed to be void... I've never used the DirectX stuff, but I think you have to pass some paramaters to CheckDeviceCaps()... I'd think you'd have to tell it which device to check???

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    44
    Ok, this is what I have found out so far:

    Doug, this will explain your confusion over the word "void". I had prototyped void CheckDeviceCaps(); (I'm sure you know () is just like (void)) in my header file and had called it in InitDirect3D(); , but it doesn't need to be implemented yet so just stubbing it out solved the problem.
    Code:
    void CApplication::CheckDeviceCaps()
    {
    }
    InitCommonControls() is supposed to do something with winXP styles; for other operating systems nothing happens. Obviously it's not needed and causing my a big freaking headache, so now the call reads /*InitCommonControls();*/

    The other two I cannot figure out. They're supposed to be helpful Direct3D functions, but don't seem to exist. I downloaded the project from the people that wrote the tutorials and still got the same errors when building.

    Anyway, just thought ya'll would want to know what the "unresolved external symbol" linker error means. It means "You called this function, and I have an address for it (prototype), but I can't find it's implementation."
    Check out all my dimensions:
    Height, width, and for a limited time only... Depth!
    -sb

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker errors
    By jw232 in forum C++ Programming
    Replies: 3
    Last Post: 06-12-2009, 12:56 PM
  2. Linker errors in VC++ 2005
    By C+/- in forum C++ Programming
    Replies: 0
    Last Post: 05-18-2007, 07:42 AM
  3. Sneaky little linker errors...
    By Tozar in forum C++ Programming
    Replies: 8
    Last Post: 10-25-2006, 05:40 AM
  4. why am i getting linker errors?
    By dantestwin in forum C++ Programming
    Replies: 11
    Last Post: 07-08-2004, 10:34 AM
  5. Linker errors with Visual C++
    By codegirl in forum C++ Programming
    Replies: 4
    Last Post: 09-11-2003, 09:20 AM

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