-3

I have a project originally developed as a .dll project in MFC but I want to convert this project to an .exe application. I have changed project settings as shown below but it didn't help.

enter image description here

Edit: Further I have changed Linker properties as Project properties -> Linker -> General -> Output file .. set to .. .Debug\DirBkgndExt.exe

When I compiled then I'm getting following error.

I googled it, and on some blogs, people are suggesting to copy paste everything from existing project to a new project of executable types. Since this project is bit huge, so that option doesn't sounds good.

enter image description here

Amnesh Goel
  • 2,617
  • 3
  • 28
  • 47
  • Out of crystal ball. Any error messages? What happens? – harper Aug 17 '15 at 09:14
  • @harper .. I have edit my question.. check it pls – Amnesh Goel Aug 17 '15 at 09:24
  • 1. Your dll's entry point was DllMain(); did you write main() or WinMain()? 2. How is it supposed to interact with the user? – Vlad Feinstein Aug 17 '15 at 11:52
  • I haven't changed the code... – Amnesh Goel Aug 17 '15 at 11:53
  • So what is it that you really want? Even if you successfully compile and link your new exe, what are you going to do with it? Does it implement any UI? Is it a single function to be called with certain parameters? How is this DLL used today? May be you just need to create an application that will interface with it, and leave it be a dll? – Vlad Feinstein Aug 17 '15 at 13:18

3 Answers3

2

It may be simpler to create a new project with the application wizard and to move all the source files into the new project.

The problem ist that there are some property sheets that are added to the project by the wizard. And may they are not switched when you change the type of project.

In my projects I can see a linker option /DLL inside the project settings for a DLL that I can not influence. Check your linker settings and look into the command line options.

Also open the Property Manager and check what properties are added and replace them.

But again: It seams simpler to me to create a new appropriate project and move/add the source files into/to it.

xMRi
  • 14,982
  • 3
  • 26
  • 59
  • This is not the solution that I'm looking for, though this can be considered as the last option.. anyways thanks for your time.. – Amnesh Goel Aug 17 '15 at 09:52
  • Compare the attached property sheets in the property manager. Or create two projects (DLL/EXE) and compare the project files. – xMRi Aug 17 '15 at 13:12
1

What do you expect to happen here? The DLL doesn't have an entry point (well it has, but not one for a standalone application), so what should the software do when the exe is run? You need to provide a 'driver' that will start whatever you want to happen. Make a new exe application (win32 or console?), copy the 'bootstrapping' code from that into your existing application, and do stuff like initialization/argument parsing etc there.

Probably you should make separate configurations: one that builds as a dll, one that builds as exe. Then use macros to keep code that is specific to each build contained. This is what I do for libraries for which I have an embedded test/development UI.

Roel
  • 19,338
  • 6
  • 61
  • 90
0

I think I was in a pretty similar spot to you, except that I had code behind relevant #defines so that the project should have been able to be built as an .exe pretty easily (like main()).

I flipped the same settings you did, plus the following (In VS2012):

In Linker > Input, make sure Module Definition File is blank (for me it said foo.def)

Then I could build a runable .exe

sg_man
  • 763
  • 1
  • 6
  • 14