I am using DevC++ and I am trying to write a dll. I am using the following code but I get this error.
Code:
C:Dev-Cppc++ dll string$Makefile.win [Build Error] No rule to make target `C++_DLL_STRINGprivate.rc', needed by `C++_DLL_STRINGprivate.res'. Stop.
dllmain.cpp
Code:
/* Replace "dll.h" with the name of your header */
#include "dll.h"
#include <windows.h>
DLLEXPORT string returnstring(void);
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
/* Returns TRUE on success, FALSE on failure */
return TRUE;
}
dll.h
Code:
#include <cstdlib>
#include <iostream>
#ifndef _DLL_H_
#define _DLL_H_
#if BUILDING_DLL
# define DLLEXPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
using namespace std;
DLLEXPORT string returnstring(void)
{
string my_string("hello big world");
return my_string;
}
#endif /* _DLL_H_ */
untitled1.rs(needed for program I am using the dll with)
Code:
#include "dll.h"
STRINGTABLE
BEGIN
{
1 "returnstring%[s%returnstring%"
}
Why do I get this error and how do I fix it.