Menu

Dev-Cpp 5.6.3 with TDM-GCC 4.8.1 not compiling the sample DLL (either C and C++ project)

Compiling
M.Trifon
2014-06-19
2014-10-10
  • M.Trifon

    M.Trifon - 2014-06-19
    Post awaiting moderation.
  • M.Trifon

    M.Trifon - 2014-07-01

    I found a solution for the problem. It comes in form of a custom makefile, that is a patched makefile.win created by my Dev-C++
    Basically, the tool dllwrap is not used any more. All the work is driven by g++
    Also, I've changed slightly the sample DLL and the caller program, such that user may see what went wrong.
    Note that I don't make use of prefabricated DEF files (actually, seldom did...).
    For the sake of clarity, the solution I present is actually taken from Scintilla's makefile for GCC (that works !).

     
  • M.Trifon

    M.Trifon - 2014-10-04

    A question for this forum maintainer : what is wrong with my 1st message above to still place in "awaiting moderation" bin for more than 3 months ?
    I am still convinced I found a small communication problem between Dev-C++ and TDM-GCC.

     
  • Matthew MacGregor

    I was able to reproduce this issue (default dll project not building) in 5.7.1. I'll spend a little time pulling together additional detail for the maintainer and will file a ticket, if you didn't already M. Trifon.

     
  • Matthew MacGregor

    Hello. I spent some time this evening and I believe that I've figured out the problem with Dev-Cpp not compiling the sample dll project.

    EDIT: It's worth noting that I can only reproduce this problem with DLL Projects in C. The autogen makefile for C++ seems unaffected.

    There's a simple error in the autogenerated makefile:

    Def and lib files are defined:

    DEF = libDllTest4.def
    STATIC = libDllTest4.a

    But for that build target:

    $(CC) -shared $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEFFILE),--out-implib,$(STATICLIB),--add-stdcall-alias

    Notice they are $(DEFFILE) instead of $(DEF) and $(STATICLIB) instead of $(STATIC).

    I'll create a ticket with the gory details. One other thing that I noticed was that when I have the Makefile.win open in dev-cpp editor pane, I cannot compile. It tells me that the file is invalid. If I close the Makefile.win in dev-cpp and edit it in Notepad++, the error does not occur.

     

    Last edit: Matthew MacGregor 2014-10-10
  • Matthew MacGregor

    The Makefile.win is autogenerated in code, so we'll need to wait for a release to properly fix the issue. In the meantime the following steps resolved this for me:

    • Attempt to compile your dll project. This will generate the Makefile.win but will fail.
    • Open the Makefile.win in a text editor.
    • Change the following line from:
    $(CC) -shared $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEFFILE),--out-implib,$(STATICLIB),--add-stdcall-alias
    

    to:

    $(CC) -shared $(LINKOBJ) -o $(BIN) $(LIBS) -Wl,--output-def,$(DEF),--out-implib,$(STATIC),--add-stdcall-alias
    
    • Save the file. Make sure that Makefile.win is not open in the dev-cpp editor, this will cause an error!
    • Open Project Options. Choose the Makefile tab. Select the Makefile.win. (See the attached image if you need more detail).
    • Clean the project. Rebuild.
    • If you add new files to your project, you will need to manually edit the Makefile.win. It is no longer being autogenerated.

    Hopefully this will resolve the issue for you as well!

     

    Last edit: Matthew MacGregor 2014-10-10
  • Matthew MacGregor

    By the way, M. Trifon, your makefile also worked for me. That being said, it's a very minor change to the existing Makefile.win to fix this issue.

    Please give this fix a try and see if it resolves the issue for you as well.

    Ticket submitted here: Ticket 136

     
  • orwelldevcpp

    orwelldevcpp - 2014-10-10

    As can be seen in the reply to ticket 136, the problem has been fixed as of 5.8.0.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.