views:

93

answers:

2

I've been following the tutorial from msdn and it just doesn't work.

First problem I have is that sometimes the .dll and .lib aren't built. Instead I only get .objs. Whenever I build the .dll project, it gives me a popup asking to "please specify the name of the executable file to be used for the debug session". I was told to change my startup project to one with a main function, but then the .dll doesn't get built. This happens both using the default VS configuration and simply adding some lines or following the step-by-step guide at msdn.

When the .dll and .obj are built - God knows how - I can't get them to be recognized. I've tried putting them and the .h in the project folder, but then I get an error about the .dll function being undefined. Following the msdn link, at one point it says:

  1. To use the math routines that were created in the dynamic link library, you must reference the library. To do this, select References… from the Project menu. On the Property Pages dialog box, expand the Common Properties node, select References, and then select the Add New Reference… button. For more information about the References… dialog box, see Framework and References, Common Properties, Property Pages Dialog Box.

  2. The Add Reference dialog box is displayed. This dialog lists all the libraries that you can reference. The Project tab lists all the projects in the current solution and any libraries they contain. On the Projects tab, select MathFuncsDll.

If I go Project > Test Properties > Common Properties I can only find the subitem "Framework and References". There is no "References..." There is an "Add new Reference..." button, but that doesn't let me add anything. The other button, "Add Path..." doesn't make any difference even when I set it with the directory with the files. The following steps don't work either.

I've also tried to add the name of the file at the Linker, but then it says it couldn't find the .obj file.

I have no idea where to go from here. I been stuck on this for hours and nowhere has a solution for this.

Is there a step-by-step guide anywhere that actually works for VS2008?

+1  A: 

firstly your description is mixing managed (.net) things with normal c++ stuff. I assume you are doing normal c++ stuff.

DO you own (I mean have the source; are the author) both the DLL and the calling program? If so you should have 2 VS projects one for the DLL and one for the program. You should set the program as the startup project. This will make the debugger behave correctly

IN order to get the build right you need to make the c++ program depend on the dll project. There is a Project | Project dependies dialog that will do this for you, set the program project to depend on the dll project

If you only own the DLL then you need to go to the project properties | debug and tell it what binary to run to call your DLL.

If this is managed c++ then its a whole different storty

pm100
A: 

Try to specify Project Dependencies between your DLL project and project of application that uses the DLL.

The References settings are dedicated to .NET projects.

mloskot