Page 2 of 3 FirstFirst 12 3 LastLast
Results 11 to 20 of 30

Thread: The "Developers" FAQ

  1. #11
    Join Date
    Sep 2009
    Location
    Mitcham, London
    Posts
    820

    Default Suggestions Technical Faqs

    What keeps cropping up is LNK1104 errors - maybe we should have a...

    "How do I set up the directories options in Visual Studio ?" Faq
    or..
    "How do I know which windows libraries my program is using ?" Faq

    And would be nice to have a definitive, easy to understand...

    "What are pointers and why do they do my head in ? Faq
    !

  2. #12

    Default

    If you write them, I'll get them up here

  3. #13
    Join Date
    Sep 2009
    Location
    Mitcham, London
    Posts
    820

    Default

    Ok I'll have a go

  4. #14
    Join Date
    Sep 2009
    Location
    Mitcham, London
    Posts
    820

    Default How do I...

    Here goes:
    Q: "How do I set up the directory options in Visual Studio ?"

    A:
    The Windows SDK and Direct X SDK directories could be missing in the configuration properties.
    This can happen if the SDK's were already installed when you installed Visual Studio.
    You have to do this anyway when you set up a new Empty Project targetting Windows with Direct X

    For Visual Studio 2010
    In Solution Explorer, right click the project name and select Properties

    Select VC++ Directories in the left pane
    In the right pane, click the text in the Include Directories edit box and replace it with
    $(IncludePath);$(DXSDK_DIR)include;
    (Highlight the text and paste it in)
    Click Apply

    In the right pane, click the the text in the Library Directories edit box and replace it with
    $(LibraryPath);$(DXSDK_DIR)lib\x86 for 32 bit development or
    $(LibraryPath);$(DXSDK_DIR)lib\x64 for 64 bit development
    (Highlight the text and paste it in)
    Click OK

    The Windows SDK directories should have been set up by VS2010 already ( as it's clever), if not add the line
    $(WindowsSdkDir)include
    to Include Directories and
    $(WindowsSdkDir)lib
    to Library Directories
    - they must come after the DXSDK so the correct ddraw.h is used


    For Visual Studio 2008
    In Solution Explorer, right click the project name and select Properties

    For the Compiler directories:
    Expand Configuration Properties
    Select C/C++ in the left pane
    In the right pane, click the browse button on Additional Include Directories
    Click New Line button then Browse button
    Browse to and select your Direct X SDK Include folder, usually at
    C:\Program Files (x86)\Microsoft DirectX SDK (August 2007\Include
    Click OK
    Click New Line button again
    Click Browse and this time select your Windows SDK Include directory, usually at
    C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Include
    Click OK

    For the Linker directories:
    Expand Configuration Properties
    Select Linker in the left pane
    In the right pane, click the browse button on Additional Library Directories
    Click New Line button then Browse button
    Browse to and select your Direct X SDK Library folder, usually at
    C:\Program Files (x86)\Microsoft DirectX SDK (August 2007)\Lib\x86
    Click OK
    Click New Line button again
    Click Browse and this time select your Windows SDK Library directory, usually at
    C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Lib\x86
    Click OK.
    Last edited by _Q_; 01-14-2011 at 09:35 PM.

  5. #15
    Join Date
    Sep 2009
    Location
    Mitcham, London
    Posts
    820

    Default

    This one maybe need editing by yaustar or someone, but this is how I understand it...

    Q: "What is a pointer ?"

    A:
    Declaring a pointer to Something in C++ will essentially give you the address in memory where the Something is stored. The compiler also remembers what the Something is that you're pointing to. In having the address of an object, you can access the object. If the object is a class that exposes methods and variables, you can access them as well, since the compiler knows the address of Something and it knows the address of the methods and variables exposed by Something. If you declare a pointer and want to call a method that is part of the Something class use the syntax:

    Something* pSomething; // Declare a pointer to the Something class
    // (the compiler knows all about Something already)

    pSomething->SomeMethodBelongingToSomething(); // Call the method

    If the Something class has been declared on the stack, that is, within a function's braces, you can access it directly with the syntax:

    Something something; // A local instance of the Something class

    something.SomeMethodBelongingToSomething(); // Call the method

    // Equally...
    Something something; // A local instance of the Something class
    Something* pSomething = &something; // Point to the something we just created

    pSomething->SomeMethodBelongingToSomething(); // Call the method

  6. Default

    I give it a try but without some visual aids, it might be difficult:

    Every variable, class instance and function is stored in memory. A pointer holds an memory address of a particular type (the exception is a void pointer but that's something you want to avoid at all costs). E.g

    int * blah; // Stores a memory address to an instance of Foo
    Foo * blah; // Stores a memory address to an instance of Foo

    And for functions:
    void (*blah)(int); // Stores a memory address to a void function that takes one int parameter. Known as a 'function pointer'

    When you dereference a pointer, you can access the actual variable/class instance/function itself to use. E.g
    int meh = 0;
    int * blah = &meh; // The & means 'get the memory address of'
    (*blah) = 10; // Dereferencing the pointer means we are now accessing the int at the memory directly which in this case is meh. So now meh = 10

    If you really wanted to, you can have a pointer pointing to a pointer pointing to a pointer etc.

    For classes and structs, you will see '->' being used to access the functions and member variables instead of the usual '.'. E.g

    Foo * blah = &anInstance;
    blah->randomFunction();

    All the -> is really doing is:
    (*blah).randomFunction();

    When you pass a pointer to a function, it means you can directly access the object that pointer is holding the address of instead of a copy of the object. However, it is preferable in C++ to pass by reference instead whenever possible.

  7. #17

    Default

    I can stick photos/images in if needed.

  8. #18
    Join Date
    Sep 2009
    Location
    Mitcham, London
    Posts
    820

    Default

    Quote Originally Posted by yaustar View Post
    When you pass a pointer to a function, it means you can directly access the object that pointer is holding the address of instead of a copy of the object. However, it is preferable in C++ to pass by reference instead whenever possible.
    Yea we need a "What is a reference ?" answer as well
    - syntax completely different, same syntax as a normal variable which is confusing
    - and
    references very important in game programming as they are fast and the compiler don't create a copy
    - and
    references to pointers !
    .->

  9. #19
    Join Date
    Sep 2009
    Location
    Mitcham, London
    Posts
    820

    Default

    Just edited those directory settings again, it seems as though VS has to parse the winSDK first
    if you're using Aug2007 directx with winsdk 7.0a, gets very confused if you parse dx7 before sdk 7.0a


    - was funny seeing Windows find errors with itself though - like

    - cannot fins file "windows.h" - eh ?

  10. #20

    Default

    Updated, with new Q&A from _Q_ and yaustar

Similar Threads

  1. Replies: 20
    Last Post: 07-31-2010, 05:21 PM
  2. Replies: 0
    Last Post: 06-22-2010, 10:59 AM
  3. Just Signed up on "Game Design Course" Paolo
    By Godfather10 in forum Newbies Area
    Replies: 7
    Last Post: 06-10-2010, 10:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •