Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old April 11, 2017, 23:09   #1
Siemelink
Rookie
 
Join Date: Feb 2014
Location: Hungary
Posts: 16
Siemelink is on a distinguished road
Compiling with VS2015

Hi all,
I am trying to compile 4.0.5 with microsoft visual studio community 2015. I am getting loads of errors.
There is the old instruction to compile, it is not quite accurate. My exact project settings are in the attachment.

1)
I've added all the .h and .c files, the files in the win folder. When I compile i receive eror: macro definition of snprintf conflicts with Standard Library function declaration

This code seems outdated, so I've commented it out snprintf:
/**
* Native MSVC compiler doesn't understand inline or snprintf
*/
#ifdef _MSC_VER
# define inline __inline
//# define snprintf _snprintf
#endif

2)
Next, I get that pwd.h is not added. But I find the #include <pwd.h>under UNIX, while I am trying to compile as WINDOWS

So I've added || defined(_MSC_VER) to gain:
/**
* Extract the "WINDOWS" flag from the compiler
*/
# if defined(_Windows) || defined(__WINDOWS__) || \
defined(__WIN32__) || defined(WIN32) || \
defined(__WINNT__) || defined(__NT__) || defined(_MSC_VER)
# ifndef WINDOWS
# define WINDOWS
# endif
# endif

3)
now I am left with 100s of errors. I like this one:

static const int list_size = 64;
const char *initial_pronoun;
const char *name_list[list_size];

"Expression (list_size) must have constant value," which has been defined just two lines above!

There is probably something obvious that I missed. Does someone have a clue?

Thanks, Willem.
Attached Files
File Type: txt angband_visual_studio_2015_step_by_step.txt (1.8 KB, 52 views)
Siemelink is offline   Reply With Quote
Old April 11, 2017, 23:51   #2
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,012
Donated: $40
Pete Mack is on a distinguished road
MSVC is known not to be fully compliant in c99. You can change the const int to a #define with no bad effects.
Pete Mack is offline   Reply With Quote
Old April 12, 2017, 00:29   #3
t4nk
Swordsman
 
Join Date: May 2016
Posts: 306
t4nk is on a distinguished road
Maybe just don't use a C++ compiler to compile a program that is not written in C++
t4nk is offline   Reply With Quote
Old April 12, 2017, 03:44   #4
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,012
Donated: $40
Pete Mack is on a distinguished road
MSVC does work for C, it just never was updated fully to later standards. I don't know why. Adding that kind of thing to a compiler is pretty easy.
Pete Mack is offline   Reply With Quote
Old April 12, 2017, 23:26   #5
Siemelink
Rookie
 
Join Date: Feb 2014
Location: Hungary
Posts: 16
Siemelink is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
MSVC does work for C, it just never was updated fully to later standards. I don't know why. Adding that kind of thing to a compiler is pretty easy.
Yes, I've been using MSVC for over a decade to compile angband.

It does not seem to like nested typedefs, #typedef char bool gives errors where bool is used. If I replace bool with char, it does compile. But clearly doing that throughout the code is not optimal.

Willem.
Siemelink is offline   Reply With Quote
Old April 12, 2017, 23:56   #6
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,012
Donated: $40
Pete Mack is on a distinguished road
MSVC doesn't have stdbool.h
You can write your own, then add -I. to the compile line.
http://stackoverflow.com/questions/5...s2010-question
Pete Mack is offline   Reply With Quote
Old April 16, 2017, 10:17   #7
Siemelink
Rookie
 
Join Date: Feb 2014
Location: Hungary
Posts: 16
Siemelink is on a distinguished road
Quote:
Originally Posted by Pete Mack View Post
MSVC doesn't have stdbool.h
You can write your own, then add -I. to the compile line.
http://stackoverflow.com/questions/5...s2010-question
Angband has h-basic.h, which defines bool as well:

/* Use a char otherwise */
typedef char bool;

#undef TRUE
#undef FALSE

#define TRUE 1
#define FALSE 0

#endif

replacing the typedef with #define bool char seems to recover bool.

But the order of includes seems off. get.h gives errors in the getset definition, bool is not defined. I can add #include "h-basic.h" in get.h to get a bit further.

Then I am stuck on item_filter, which is not defined anywhere, in any file.

bool get_item(struct object **choice, const char *pmt, const char *fail, cmd_code cmd, item_filter filter, int mode);

Confusion reigns!
Siemelink is offline   Reply With Quote
Old April 16, 2017, 10:26   #8
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,012
Donated: $40
Pete Mack is on a distinguished road
get.c, line 54
Pete Mack is offline   Reply With Quote
Old April 16, 2017, 14:10   #9
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,859
Donated: $40
takkaria is on a distinguished road
Your problem is that you shouldn't be compiling get.c or get.h, they're not used. They should be removed, I think that's my fault that they're still there.
__________________
"Physician, heal thyself."
takkaria is offline   Reply With Quote
Old April 16, 2017, 23:12   #10
Siemelink
Rookie
 
Join Date: Feb 2014
Location: Hungary
Posts: 16
Siemelink is on a distinguished road
Quote:
Originally Posted by takkaria View Post
Your problem is that you shouldn't be compiling get.c or get.h, they're not used. They should be removed, I think that's my fault that they're still there.
Oh, that made a difference!
Now I only have one more nut to crack, a linker error:

unresolved external symbol _FreeDIB referenced in function _Term_xtra_win_react

Neither of those keywords means something to me.

Willem.
Siemelink is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling Z+Angband Ravenheart87 Variants 7 May 24, 2011 09:35
Compiling 3.2 Omnipact Development 6 December 27, 2010 10:39
compiling in VC6 NeoWizard Vanilla 1 January 16, 2009 03:10
Compiling in Linux trickypig Vanilla 6 November 16, 2008 16:26
Compiling 3.0.9b under SuSE 9.3 ... TJA Vanilla 14 May 12, 2008 22:17


All times are GMT +1. The time now is 05:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.