DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   Dll's and problems with them (http://www.daniweb.com/forums/thread63074.html)

Barefootsanders Nov 28th, 2006 2:03 pm
Dll's and problems with them
 
Hey guys, I was writing code or DLL's (doubly linked lists) and I think I have everything right but it keeps giving me a makefile error. My code is below along with the error log. ANy help would be apprecaited.

//DLLNode.h

#include <iostream>
#include <cstdlib>

#ifndef DOUBLY_LINKED_LIST
#define DOUBLY_LINKED_LIST

template<class T>
class IntDLLNode
{
    public:
        IntDLLNode();
        IntDLLNode(const T&,IntDLLNode*,IntDLLNode*);

    protected:
        T info;
        IntDLLNode *next,*prev;
};

#endif

//DLLNode.cpp

#include "DLLNode.h"

template<class T>
IntDLLNode<T>::IntDLLNode()
{
    next = prev = NULL;
}

template<class T>
IntDLLNode<T>::IntDLLNode(const T& el,IntDLLNode *n = NULL,IntDLLNode *p = NULL)
{
    info = el;
    next = n;
    prev = p;
}

Error Log:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\My Documents\C++\Lab06\Makefile.win"
Executing make...
make.exe -f "C:\Documents and Settings\My Documents\C++\Lab06\Makefile.win" all
g++.exe DLLNode.o -o "Lab06.exe" -L"C:/Dev-Cpp/lib"

C:/Dev-Cpp/lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status

make.exe: *** [Lab06.exe] Error 1

Execution terminated

Ancient Dragon Nov 28th, 2006 2:50 pm
Re: Dll's and problems with them
 
All dlls must have DllMain(). This is the code generated by M$ VC++ compiler when creating a dll project.
BOOL APIENTRY DllMain( HMODULE hModule,
                      DWORD  ul_reason_for_call,
                      LPVOID lpReserved
                                        )
{
        switch (ul_reason_for_call)
        {
        case DLL_PROCESS_ATTACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
                break;
        }
    return TRUE;
}


All times are GMT -4. The time now is 11:34 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC