mIRC Homepage
Posted By: behrendt Compiling problem with Dev-C++ - 15/07/07 11:55 PM
Hi,

I was trying to create a simple DLL wich should return "Hello World", but I failed.

I am using Dev-C++ (4.9.9.2)

Here is what I did:

File -> new -> project -> DLL -> Project1

Adding...


dllmain.cpp

Code:
#include <windows.h>

extern "C" int WINAPI func(HWND,HWND,char *data,char*,BOOL,BOOL)
{
	lstrcpy(data,"Hello World");
	return 3;
}


dllmain.def

Code:
LIBRARY Project1
EXPORTS
func


After compiling, "Makefile.win" is being activated and there is this red marked:


dllmain.o: dllmain.def
$(CPP) -c dllmain.def -o dllmain.o $(CXXFLAGS)


And here the compiler log:

Code:
37 C:\Dev-Cpp\Makefile.win [Warning] overriding commands for target `dllmain.o' 
34 C:\Dev-Cpp\Makefile.win [Warning] ignoring old commands for target `dllmain.o' 
34 C:\Dev-Cpp\Makefile.win [Build Error] multiple definition of `dllinfo@24' 
34 C:\Dev-Cpp\Makefile.win [Build Error] first defined here 
34 C:\Dev-Cpp\Makefile.win [Build Error] ld returned 1 exit status 
 C:\Dev-Cpp\Makefile.win [Build Error]  [Project1.dll] Error 1 


This is my first try at creating a DLL, so can anyone help me out here?
Posted By: Necroman Re: Compiling problem with Dev-C++ - 22/07/07 06:25 PM
Try to remove the .DEF file from your project and add the following to "Project Options", "Linker parameters":

--def dllmain.def

I have no idea how Dev-C++ works - just googling.
Posted By: NaquadaServ Re: Compiling problem with Dev-C++ - 23/07/07 04:19 PM
Did the previous advice work? My makefile knowledge is a bit rusty but this...

dllmain.o: dllmain.def
$(CPP) -c dllmain.def -o dllmain.o $(CXXFLAGS)

... is saying to produce dllmain.o (the object code for dllmain.cpp), execute the command "$(CPP) -c dllmain.def -o dllmain.o $(CXXFLAGS)". Clearly incorrect since your source file is dllmain.cpp.

The dllmain.def after the colon (on the first line), is OK... That is just saying that if the def file changes, recompile dllmain.cpp.
© mIRC Discussion Forums