Warning: "No local application has been provided. You can set it in the Run menu, Parameters" Dynamic DLL Creation Problem in C++ in DEV++

Asked

Viewed 57 times

2

I am trying to create a DLL with the code that the teacher passed, but it does not compile correctly. Keeps appearing the warning:

"No local application provided. You can set it in the Run menu, Parameters"

  1. What would those be Parâmetros which I must put?
  2. In this case I want to show the HelloWord on the screen, I would have to create a file .dll in a text editor and put inside it HelloWord? And then compile it?

Follow the main DLL:

 #include <windows.h>
 #include <iostream>

 using namespace std;
 typedef void (*MyFunc)(void);

 /* run this program using the console pauser or add 
  your own getch, system("pause") or input loop */

 int main(int argc, char** argv) {

     HINSTANCE hinst;
     MyFunc Hello;
     hinst = LoadLibrary("MyDLL.dll");
     if (!hinst)
     {
         MessageBox(0,"DLL File not found!", "Error", MB_ICONERROR);
         exit(0);
     }

     Hello = (MyFunc)GetProcAddress(hinst,"HelloWorld");
     Hello();
     FreeLibrary(hinst);
     exit(0);

     return 0;
}

Follows the function DLL:

#ifndef _DLL_H
#define _DLL_H

#if BUILDING_DLL
#define DLLIMPORT _declspec(dllexport)
#else
#define DLLIMPORT _declspec(dllimport)
#endif

DLLIMPORT void HelloWord();

#endif

1 answer

1


It looks like you are trying to run the DLL project.

You need to create two projects:

  • a project of the type DLL where you will place the code of your Helloworld() function in the dllmain.cpp file;
  • and a project of the type Console Application where you will place the main() function code in the main.cpp file.

Create projects in the same directory.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.