![]() |
#1 |
Swordsman
Join Date: Jun 2010
Posts: 309
![]() |
Visual Studio 2010 Express, help for the newbie?
Hi,
Anyone reasonably (or probably only a little) experienced with MS Visual Studio? I'm new to it and having a hard time getting it to behave reasonably. The answer to some of my problems is probably "RTFM" but I have made some attempts to do that ahead of time. :-) I created a new project using "Create project from existing source code" using the current angband tree. I can't seem to get the "Solution Explorer" to show the underlying file tree though; it shows all the source files together, and all the header files together, and so when you have files with the same name in different directories they all appear together - and it's not clear how to tell which is which even if this was a good idea: ![]() Relatedly, probably, I'm having trouble building it in part because it can't find header files it needs. I can solve many of these by manually adding each directory in src/*/ to its include path, but this is hardly portable in addition to being very much a pain. There must be a more general way to do this... Any pointers and tip and tricks would be welcome! Thanks, -C |
![]() |
![]() |
![]() |
#2 |
Ironband/Quickband Maintainer
Join Date: Nov 2007
Posts: 1,009
![]() |
I can't help you on this because the NPP files are not split between directories in the way that the Vanilla ones are, so I've not had to deal with the problem. (And am far from an expert anyway)
A.
__________________
Ironband - http://angband.oook.cz/ironband/ |
![]() |
![]() |
![]() |
#3 | |
Hellband maintainer
Join Date: Jul 2007
Location: New York, the Big Apple
Age: 45
Posts: 367
Donated: $120
![]() |
Quote:
* Things to do that I know off * right click on the project, click config properties, c/c++, general, additional include directories, add the src folder since header files are located there for code files in subdirectories * Still under c/c++, click on Command Line, make sure the following switch is in there : /D "_WINDOWS" * At some point there will be confusion with include dirent/direct.. I think I just used the POSIX direct ( I posted about this ) and did the same as OSX, this compiled better ( as in I got stuck somewhere else ) * I Got rid of the test code folder when I imported files since it failed miserably, myshkin has added some more files on April 27, so your mileage may vary In the end this all didnt work for me still, somehow the externs in externs.h didnt jive with the linker and all references to functions with char or char* died... There is a stackoverflow post on this, but at that point I was ready to kill somebody and with my latent heart condition I decided to just give up and play some more EVE. T.
__________________
* Are you ready for something else ? Hellband 0.8.8 is out! * |
|
![]() |
![]() |
![]() |
#4 |
Adept
Join Date: Apr 2011
Posts: 103
![]() |
I use VC++ 6.0, so some of the terminology will be different, but what I do is start with a new, blank win32 project. Next rename src/player/util.c to putil.c. Then I add all of the .c and .h files in the src directory to the project except those that have main in their name and snd-sdl.c. Then I add all of the .c and .h files in the player, object, monster, and win directories. Then I add src/main-win.c to the project. Next I add the additional include directories: src, src\player, src\object, src\monster, src\win, src\win\include. Then you need to add the library modules src\win\lib\libpng.lib and src\win\lib\zlib.lib. Finally I save the project and can start compiling.
Here things will probably get very different. Because I use VC++6.0 I am using an older Win32 SDK and compiler. So I also have to remove the extra const on line 74 of externs.h. In z-queue.h I have to remove the line: #include <stdint.h>and replace it with: typedef unsigned int * uintptr_t; In generate.c I have to comment out the defines of ROOM_DEBUG and ROOM_LOG, and replace where they are used with the code of the macro. (I have to replace "ROOM_LOG(" with "if (OPT(cheat_room)) msg(".) In cmd4.c I need to replace snprintf with strnfmt. Lastly, in main-win.c I have to replace GetWindowLongPtr with GetWindowLong, replace SetWindowLongPtr with SetWindowLong and GWLP_USERDATA with GWL_USERDATA. If the projects in the other thread don't help, I hope this does. Edit: changed the png include directory and libs above to match angband. Another Edit: As APWhite says below, the library module winmm.lib also needs to be added. Also, the resource file (src/win/angband.rc) needs to be added to the project. Last edited by Blue Baron; June 14, 2011 at 20:05. |
![]() |
![]() |
![]() |
#5 | |
Angband Devteam member
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 42
Posts: 1,516
![]() |
Quote:
![]() |
|
![]() |
![]() |
![]() |
#6 | |
Adept
Join Date: Apr 2011
Posts: 103
![]() |
Quote:
![]() Edit: I guess the only changes that I would ask for are to remove the extra? const from line 74 of externs.h and change the snprintf's in cmd4.c to strnfmt's. snprintf is only used 3 times in cmd4.c and once in main-crb.c. strnfmt is used around 330 times? Also, I think the following lines should be removed from hook_quit() in main-win.c since they are also in cleanup_angband(): string_free(ANGBAND_DIR_XTRA_FONT); string_free(ANGBAND_DIR_XTRA_GRAF); string_free(ANGBAND_DIR_XTRA_SOUND); string_free(ANGBAND_DIR_XTRA_HELP); The memory is freed, but is not set to NULL, so it gives an exception for me the second time in cleanup_angband. Actually these strings are initialized in two places as well in init_stuff() in main-win.c and init_file_paths() in init2.c. Is this a memory leak? maybe only initialize them in main-win.c if they are NULL? Last edited by Blue Baron; June 14, 2011 at 05:22. |
|
![]() |
![]() |
![]() |
#7 |
Swordsman
Join Date: Jun 2010
Posts: 309
![]() |
Thanks - I will continue to experiment with MSVC, but so far it has been both frustrating and unproductive. I was able to get a clean, running compile in about 30 minutes with Eclipse and MinGW (all 30 minutes getting the eclipse settings correct; no code adjustments needed).
I'm disinclined to change the organizational structure of the directory tree if I can avoid it, in the interest of making it as simple as possible to keep repositories in sync, but it remains to be seen whether I get get MSVC to agree with me on that point. |
![]() |
![]() |
![]() |
#8 | |
Adept
Join Date: Jul 2007
Location: St George Utah, USA
Posts: 244
![]() |
Quote:
I use MSVC for all my angand stuff. I use VS2008. I wrote up a step by step a few months back. Creating a VS2008 Project using the borg and the official release. 1. Download the game source code 2. Download the borg source then unzip it into the \src directory. 3. Create a new project using VS2008 4. Exclude from the project the directories gtk, nds, osx. And the "main-???" files except main-win.c 5. Project -> Angband Properties -> Configuration Properties -> C/C++ -> Code Generation -> Run Time Library -> /MT 6. Project -> Angband Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies -> winmm.lib 7. Project -> Angband Properties -> Configuration Properties -> General -> Common Language Runtime Support -> No CLR 8. Edit config.h line 100. Remove the comments to #define ALLOW_BORG 9. Rename player\util.c to player\p-util.c 10. Remove the "main" entry point from Project -> Angband Properties -> Configuration Properties -> Linker -> Advanced -> Entry Point Try these steps and let me know how you do. I should be able to walk you through the process. |
|
![]() |
![]() |
![]() |
#9 | |
Adept
Join Date: Apr 2011
Posts: 103
![]() |
Quote:
The directory structure does not need to be changed, except to rename src/player/util.c to src/player/putil.c or something. Its just that I have static png libraries that I built myself, and use, and forgot to change the paths in my post. I think a recent Visual Studio user only needs to be careful about which files are added to the project, the include directories, and the png libraries. Also, the "Solution Explorer" only shows files that have been added to the project, rather than the actual directories. Anyways, all this is for whatever development environment you want to use, so use whatever you are comfortable with and works for you. |
|
![]() |
![]() |
![]() |
#10 |
Swordsman
Join Date: Apr 2011
Location: Göteborg, Sweden
Posts: 348
![]() |
This is exactly what I want as well :-) Chud, could you write up a step by step procedure for me? Did you use the project files Magnate posted?
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Issue with compile on Windows 7 64-bit using Visual C++ Express command line | -K- | Development | 1 | January 15, 2011 20:28 |
Request for votes: Ascii Dreams Roguelike of the Year 2010 | andrewdoull | Idle chatter | 2 | January 2, 2011 13:39 |
angband elites 2010 | dos350 | Vanilla | 2 | September 26, 2010 17:30 |
Visual Studio 2008 - building 32 & 64 bit now! | LanceDiamond | Development | 5 | April 25, 2009 13:59 |
Getting Visual C++ 2008 Express Edition to compile Angband 3.0.9 | Orillian | Vanilla | 5 | February 10, 2008 09:23 |