Why won't it work

Pages: 12
Grey Wolf already told you how to remove the DLL dependancy, link statically.
Grey Wolf wrote:
Something like:
Project Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library. {set to one without DLL at the end}
set it to MT for release mode and MTd for debug.
closed account (z05DSL3A)
DTSCode wrote:
ok if someone would actually listen to me..
I know, shocking isn't it? :0)
Grew wolf...I don't really understand how that would remove dependencies, so I'm not sure what to do. If I copied and pasted what you wrote would it work? Since I now nothing in this area I really don't know what to do.
closed account (z05DSL3A)
Try:
How to: Modify Project Properties and Configuration Settings
http://msdn.microsoft.com/en-us/library/z15yzzew.aspx

Sorry for being terse, I need to get some sleep (it's 2am here)
When I looked at the dependencies box it said it didn't depend on anything else. But when I send any program that I ever make to my friends they can't open it. What the heck is wrong?
closed account (z05DSL3A)
Ask your friend what error message they get and then you can post the message here.
,MSVCP100D.dLL is missing from your computer'

That's what one of my friends says the error is.
closed account (z05DSL3A)
In Solution Explorer, select a project.
On the View menu, select Properties Window.
In the first dropdown at the top of the Properties Window select Release
In the Properties window, modify the properties you want to change.
Select Configuration Properties
Select C/C++
Select Code Generation
Find Runtime Library and change in to /MT
Go back to the dropdown and select debug
now change Runtime Library and change in to the debug version of /MT
click Ok.

In the toolbar find the dropdown that says debug and change it to release.
build your project.
If all goes well, find the .exe in the release folder and give it to your friend.

NB: The above instructions are from memory but should be close enough to find your way.
Ok, I'm a smart guy and all, but I have no idea what I'm doing. I changed the runtime library to /mt in the generation code, but the last bit of instructions is confusing and it seems like I'm repeating what I already did. The BREAK, CONTINUE, and IGNORE thing still popped up. Is it supposed to solve the error I receive, or that my friends receive? Why can't we do skype and share screens? What's the meaning of life? Why am i giving a spiel?

PS:This time when I debugged it said that source code was missing or something like that except it said it in a read only error box that normally would be a cpp file.
Last edited on
closed account (z05DSL3A)
Debug v Release
When you work on the code on your computer you use debug mode. This 'links'* your program to the code. When you are happy that your program works you switch to release and build the project again and distribute that program. It will not have the extra bits to help debugging.

Static v Dynamic Linking
VS defaults to dynamic linking. The effect of this is that anyone the wants to run your release project will have to have MSVCP100.dll on their computer. This would normally be done via an installer you write for your project but you could just put the missing dlls with your program or give them the redistributable for VS.

If you choose to do static linking, VS copies the bits of the runtime into your program so you don't have to remember to distribute the dlls. The one thing that you will need to keep an eye on is how any libraries you use link to the runtime.

It would probably do you good to do your own research on the Pros and Cons of static v dynamic linking.

Is it supposed to solve the error I receive, or that my friends receive?
I thought that it was your friend having a problem with your working code.

Why can't we do skype and share screens?
I don't do that, sorry.

What's the meaning of life?
42.

-------
* links in this case is not meant to just mean link in the compiler/linker sense but also associating symbols/code/binaries to make debugging easier.
ALL of my programs don't work my FRIENDS' computers. The one program I'm working on currently gives ME the error reading:

"First-chance exception at 0x773cf9d2 in Game (do not delete).exe: 0xC0000008: An invalid handle was specified."


Then it gives me the options:

BREAK CONTINUE IGNORE



I need to solve this error on MY screen before I tackle the issue of NONE of my programs work on my friends computers.

Sorry for being unclear the first time. This is my current program. I have a feeling the entire issue is in the function.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <cwchar>
#include <string>
#include <Windows.h>
using namespace std;

char response;
string a;

int main()
{
    

    cout << "Would you like to play a game? Y/N?";

    cin >> response;
    if (response == 'y');
        cout << "What game would you like to play? Please type in exactly what the game is called including spaces, dashes, or capitalization.";
    cout << "a";

    WIN32_FIND_DATA file;
    HANDLE search_handle=FindFirstFile("C:\\*",&file);
    if (search_handle)
    {
        do
        {
            std::wcout << file.cFileName << std::endl;
        }while(FindNextFile(search_handle,&file));
        CloseHandle(search_handle);

    }

    

    if (response == 'n')
        cout << "Goodbye!";

    //countdown loop
  for (int n=3; n>0; n--) {
    cout << n << ", ";
  }
  cout << "CIAO!\n";
  return 0;
}
Try changing CloseHandle(search_handle); to FindClose(search_handle);
The documentation for CloseHandle() clearly states:

MSDN wrote:
If the application is running under a debugger, the function will throw an exception if it receives either a handle value that is not valid or a pseudo-handle value. This can happen if you close a handle twice, or if you call CloseHandle on a handle returned by the FindFirstFile function instead of calling the FindClose function.
OMG...the error isn't popping up. Yes! Now I have a new problem. As you can probably tell...I have no idea how the search computer function I'm using works. I don't know where to input "a" into the function so that the function searches for the certain file. For reference, here's the function.

1
2
3
4
5
6
7
8
9
10
WIN32_FIND_DATA file;
    HANDLE search_handle=FindFirstFile("C:\\*",&file);
    if (search_handle)
    {
        do
        {
            std::wcout << file.cFileName << std::endl;
        }while(FindNextFile(search_handle,&file));
        FindClose(search_handle);
}

PS: thanks for the help so far!
Topic archived. No new replies allowed.
Pages: 12