CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 31st, 2005, 11:52 AM
    mags mags is offline
    Junior Member
     
    Join Date: Apr 2005
    Posts: 5
    mags is an unknown quantity at this point (<10)
    Linkage Woes, I think extern is the problem

    Im trying to make a simple wrapper class for the BOB structure from Tricks of the Windows Programming Gurus but Im having difficulties getting it to compile.

    I have 3 files from the book and 2 files for my class. I can compile the 3 files from the book together fine, the problem arises when I try to compile my code with it. My compiler is flagging t3dlib1.h as the problem though even though it compiles with the other 2 files from the book fine without my 2 files.

    My setup:
    files from book->t3dlib1.h t3dlib1.cpp main.cpp

    t3dlib1.h has all the header info,obviously hehe, and alot of externs at the end. T3dlib1.h contains no #includes. main.cpp has all the global directX7 objects and Im guessing from my limited usage of externs that the keyword is allowing this file to "see" the global objects.

    t3dlib1.cpp has nothing out of the ordinary, it contains includes for t3dlib1.h and all the windows/directx/math headers.

    main.cpp is where all the action is. DirectX is initialized here, has all the calback windows stuff, and has the game loop for my application. Main.cpp contains all the same includes as t2dlib1.cpp.

    My files:
    BaseSprite.h includes t3dlib1.h to get access to the structures defined there, without it <the include> t3dlib1.h compiles fine but basesprite.h is flagged for "identity not found" on structures that are defined in t3dlib1.h.

    I hope Ive given enough information on my problem without being too overly confusing :P Im attaching all my source files aswell since they are pretty small in size.
    Attached Files
    File Type: zip BaseSprite.zip (32.2 KB, 32 views)

    Last edited by mags; July 31st, 2005 at 12:02 PM.
    Reply With Quote
      #2    
    Old August 1st, 2005, 02:34 PM
    mags mags is offline
    Junior Member
     
    Join Date: Apr 2005
    Posts: 5
    mags is an unknown quantity at this point (<10)
    Re: Linkage Woes, I think extern is the problem

    <RESOLVED>

    If anyone else ever has this problem this is what I did to resolve it.

    I think the compiler was trying to link the basesprite class files before t3dlib1,which has the the structures needed by basesprite.h. To fix it I added all the includes to the .cpps instead of the headers, added <ddraw.h> to basesprite.cpp so it knew what the DDRAW structures were, and made sure to add #include T3DLIB1.h before #include BASESPRITE.H in all the .cpps.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:33 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009