Jump to content

Compiling D2TM under MinGW (G++ 4.5.0)


Recommended Posts

Hi all!

I am trying to compile D2TM svn trunk with MinGW g++ 4.5.0 but I am not able to do it. The include .h and library .a files are correctly situated in the MinGW's include and lib folders. I am using NetBeans 6.9.1 with the MinGW tool chain selected. The libraries fblend, alleg, alfontdll and allmp3 are configured under Project Properties / Build / Linker / Libraries. And the path for the include files is configured in Project Properties / Build / C++ Compiler / General / Include Directories.

When I try to build the project there are some .cpp files that can be compiled but when the compiler reachs any source code file with the 'memset' instruction it returns: "error: 'memset' was not declared in this scope" and stops. For example in: structures/cOrderProcesser.cpp:17:55: error: 'memset' was not declared in this scope

What am I doing wrong? Maybe were the Allegro and fblend library files created for a lower version of g++?

Thank you.

Link to comment
Share on other sites

memset is a pretty standard C thing (see http://www.cplusplus.com/reference/clibrary/cstring/memset/) . Sounds like some includes are not working properly. Perhaps it has to do with a newer version of MinGW?

cOrderProcesser tries to find the include d2tmh.h, which is pretty much the 'include everything' header file. Can you give me a bit more log about what goes wrong when compiling?

Btw, I do think the library and such are created with a lower version, but I do not think that is the problem right now :)

Link to comment
Share on other sites

Finally I could get the code compiled with MinGW (G++ 4.5.0) and VC++ 2010.

The problem was a missing include of cstring library in d2tm.h. It is necessary add the following line: #include <cstring>

Are you actually working with the svn trunk version? I don't understand how you can get the code compiled with problems like this.

What IDE and compiler are you using to refactorize the code?

Thank you!

Link to comment
Share on other sites

I am using MinGW (gpp 3.4.5).

Where do you add the cstring include? Ive checked using Google, and it seems cstring.h is a microsoft only thing. Since I do not use that (I do not want to be MS only) it won't compile (?) in VS2010. However, in another thread someone had it working already.

As you can see in d2tmh.h, line 31 i do include string.

As for your other question regarding SVN. Yes, I am using that. In fact, I have updated the source yesterday. So if you do an SVN UP(date) you'd be happy with the fix so you can place buildings again.

Interesting read about "cstring" and "string" include headers: http://bytes.com/topic/c/answers/790421-string-h-vs-string

Link to comment
Share on other sites

I put the cstring include inside the d2tm.h file.

The point is the include is necessary for g++ 4.5.0 or VC2010. With g++ 3.4.5 it is not. I have not tested another compilers. So now, I am able to compile the code with these three compilers.

I have taken a look at your code and at your refactoring progress and I noticed there are a lot of things to do. I read in your blog about Pivotal Tracker and the scenarios/functionalities written down there but it seems there is no public access to it. I would like to contribute with some bugfixes or with the refactoring task. For example remove all the mouse stuff from the game and map classes.

How could I help you?

Link to comment
Share on other sites

Ah, that makes sense then. Well if it does not hurt for G++ 3.5.x then including cstring would be no problem i suppose.

Yes, there is still a lot of work to do in terms of refactoring. But I'm glad you've taken a look and noticed the work put into it.

I can add you as a member for pivotal tracker, and if you have a gmail account I can add you to the SVN so you can contribute code. Using pivotal you can see any kind of story/scenarios that need to be implemented so you can see what is 'left to do'. One of the obvious things are bugs of course due refactoring (like, loading up the campaign breaks the game now).

If you are interested, and have time to contribute. Just send me an email (stefanhen83 at gmail dot com).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...