VS-current svn, compile error with VS Express 2012

Trying to build your own version of Vega Strike and having problems? Unix users, paste your config.log here (stderr output alone is not helpful).
Post Reply
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

VS-current svn, compile error with VS Express 2012

Post by shenle »

Code: Select all

Error	1556	error C2664: 'aligned_allocator<T>::aligned_allocator(const aligned_allocator<T> &) throw()' : cannot convert parameter 1 from 'std::_Wrap_alloc<_Alloc>' to 'const aligned_allocator<T> &'	C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\vector	1102	1	vegastrike
Context in std::vector<_Ty, _Alloc>

Code: Select all

_Alloc get_allocator() const _NOEXCEPT
		{	// return allocator object for values
		return (this->_Getal());
		}
make me a sandwich
make: *** No rule to make target 'me'. Stop.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: VS-current svn, compile error with VS Express 2012

Post by ezee »

Hi, who is hidding in the dark corner .
need some :idea: ?
:lol:

I wasn't able to compile the actual trunk for VisualStudio , but i've found that the
svn/tags/0.5.1 rc1 is working fine .

Are you a windows dev ( you plan to code for vegastrike with visual studio ) ?
:?:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Re: VS-current svn, compile error with VS Express 2012

Post by jackS »

I know it's not the same versions, but there's a similar sounding bug listed at the Boost website that may indicate some sort of fundamental incompatibilities between recent versions of Boost and VC++
Known Bugs with Visual Studio 2013/Visual C++ 12
Visual Studio 2013 was released quite late in the release process, so there exist several unresolved issues. These include:

Serialization can't compile because of a missing include.
Using has_member_function_callable_with from Boost.Container's allocator_traits causes a compile error (#9332).
In libraries such as Unordered and MultiIndex, calling overloaded functions with initializer lists can result in a compile error, with Visual C++ claiming that the overloads are ambiguous. This is a Visual C++ bug and it isn't clear if there's a good workaround. This won't affect code that doesn't use initializer lists, or uses an initializer list that doesn't require an implicit conversion (i.e. an initializer list of the container's exact value type).
Thread: ex_scoped_thread compile fails (#9333).
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: VS-current svn, compile error with VS Express 2012

Post by shenle »

Okay, revisiting this after a half-year; have switched development toolchain to VS express 2013.

Current errors (of the latest svn checkout as of today):

Code: Select all

Error	168	error C2375: 'fmin' : redefinition; different linkage	\vegastrike\src\ship_commands.cpp	12	1	vegastrike
Error	169	error C2375: 'fmax' : redefinition; different linkage	\vegastrike\src\ship_commands.cpp	16	1	vegastrike
Error	170	error C2264: 'fmin' : error in function definition or declaration; function not called	\vegastrike\src\ship_commands.cpp	134	1	vegastrike
Error	222	error C2039: 'min' : is not a member of 'std'	  \vegastrike\src\audio\Stream.cpp	15	1	vegastrike
Error	223	error C2873: 'min' : symbol cannot be used in a using-declaration	\vegastrike\src\audio\Stream.cpp	15	1	vegastrike
Error	224	error C3861: 'min': identifier not found	\vegastrike\src\audio\Stream.cpp	64	1	vegastrike
make me a sandwich
make: *** No rule to make target 'me'. Stop.
drifter
Explorer
Explorer
Posts: 10
Joined: Sun Oct 19, 2014 12:58 am

Re: VS-current svn, compile error with VS Express 2012

Post by drifter »

Vega Strike includes windows.h in a number of places, which pollutes the code with all kinds of crap.

Add NOMINMAX to preprocessor definitions (should be somewhere in project properties, compiler ...), should be there by default in any project using windows headers imho.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: VS-current svn, compile error with VS Express 2012

Post by shenle »

Took me a while to get back to this, real life's a b*tch.

Adding NOMINMAX to preprocessor defs didn't do anything, I get the exact same errors.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
drifter
Explorer
Explorer
Posts: 10
Joined: Sun Oct 19, 2014 12:58 am

Re: VS-current svn, compile error with VS Express 2012

Post by drifter »

In they files that fail add to the includes on top:

#include <algorithm> // min/max
drifter
Explorer
Explorer
Posts: 10
Joined: Sun Oct 19, 2014 12:58 am

Re: VS-current svn, compile error with VS Express 2012

Post by drifter »

In general I also think it might be a good idea to replace all custom fmin/intmin/mymin and max variants with std::min/max
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Re: VS-current svn, compile error with VS Express 2012

Post by loki1950 »

drifter wrote:In general I also think it might be a good idea to replace all custom fmin/intmin/mymin and max variants with std::min/max
Good idea as that would help to generalize the code for the various platforms we support and ultimately reduce the custom #define macro's we need for them,that was one of the reasons we moved to cmake (it's cross-platform support)

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: VS-current svn, compile error with VS Express 2012

Post by shenle »

Okay here's a new round of testing. I started from scratch: new installation of Windows 7, installation of VS express 2013 and svn, and that's all. This is to remove any old headers and crap that may have been lurking on the old machine.

First round of compilation ends with this:

Code: Select all

Error	161	error C2375: 'fmin' : redefinition; different linkage	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	12	1	vegastrike
Error	162	error C2375: 'fmax' : redefinition; different linkage	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	16	1	vegastrike
Error	163	error C2264: 'fmin' : error in function definition or declaration; function not called	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	134	1	vegastrike
Error	222	error C2039: 'min' : is not a member of 'std'	C:\games\vegastrike\svn\vegastrike\src\audio\Stream.cpp	15	1	vegastrike
Error	223	error C2873: 'min' : symbol cannot be used in a using-declaration	C:\games\vegastrike\svn\vegastrike\src\audio\Stream.cpp	15	1	vegastrike
Error	224	error C3861: 'min': identifier not found	C:\games\vegastrike\svn\vegastrike\src\audio\Stream.cpp	64	1	vegastrike
Error	1675	error C2664: 'aligned_allocator<Vector,16>::aligned_allocator(const aligned_allocator<Vector,16> &) throw()' : cannot convert argument 1 from 'std::_Wrap_alloc<std::allocator<T>>' to 'const aligned_allocator<Vector,16> &'	C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector	1163	1	vegastrike
Second round with NOMINMAX defined and the above #include applied:

Code: Select all

Error	168	error C2375: 'fmin' : redefinition; different linkage	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	13	1	vegastrike
Error	169	error C2375: 'fmax' : redefinition; different linkage	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	17	1	vegastrike
Error	170	error C2264: 'fmin' : error in function definition or declaration; function not called	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	135	1	vegastrike
Error	1670	error C2664: 'aligned_allocator<Vector,16>::aligned_allocator(const aligned_allocator<Vector,16> &) throw()' : cannot convert argument 1 from 'std::_Wrap_alloc<std::allocator<T>>' to 'const aligned_allocator<Vector,16> &'	C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector	1163	1	vegastrike
So that seems to have fixed the errors in Stream.cpp, but not in ship_commands.cpp (the line number differences are due to the extra #include line)
make me a sandwich
make: *** No rule to make target 'me'. Stop.
drifter
Explorer
Explorer
Posts: 10
Joined: Sun Oct 19, 2014 12:58 am

Re: VS-current svn, compile error with VS Express 2012

Post by drifter »

For the fmin/fmax issue. My guess is that the compiler doesn't like the "static inline" part. Try removing inline or static qualifier.
Or replace fmin/fmax with std::min, std::max (or min, max as vs uses std namespace), don't forget the algorithm header.

According to google search vs2012/13 is very picky about custom allocators... you have to define rebind explicitely it seems.

In src/gfx/aligned.h just below (line 41)

template<typename A> explicit aligned_allocator(const A &other)...

add

template <class U>
struct rebind
{
typedef aligned_allocator<U> other;
};
drifter
Explorer
Explorer
Posts: 10
Joined: Sun Oct 19, 2014 12:58 am

Re: VS-current svn, compile error with VS Express 2012

Post by drifter »

Forget about rebind for now, won't compile, needs more changes.
drifter
Explorer
Explorer
Posts: 10
Joined: Sun Oct 19, 2014 12:58 am

Re: VS-current svn, compile error with VS Express 2012

Post by drifter »

I ve attached a working aligned.h fixes patch.

I am not 100% sure this will be enough to make msvc happy, but it is a start.
You do not have the required permissions to view the files attached to this post.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: VS-current svn, compile error with VS Express 2012

Post by shenle »

So the patch fixes the last error. Still left these:

Code: Select all

Error	8	error C2375: 'fmin' : redefinition; different linkage	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	12	1	vegastrike
Error	9	error C2375: 'fmax' : redefinition; different linkage	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	16	1	vegastrike
Error	10	error C2264: 'fmin' : error in function definition or declaration; function not called	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	134	1	vegastrike

Removing the static qualifier gives me this

Code: Select all

Error	8	error C2084: function 'float fmin(float,float) throw()' already has a body	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	12	1	vegastrike
Error	9	error C2084: function 'float fmax(float,float) throw()' already has a body	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	16	1	vegastrike
Error	10	error C2264: 'fmin' : error in function definition or declaration; function not called	C:\games\vegastrike\svn\vegastrike\src\ship_commands.cpp	134	1	vegastrike

Removing the inline qualifier gives again the first set of errors.


Changing in ship_commands.cpp fmin -> min and fmax _> max allows the compilation to finish. The compiled program however crashes during the splash screen. Stdout and stderr don't have anything useful in particular.

Stderr:

Code: Select all

USING HOMEDIR : C:\Users\s\Documents/.vegastrike As the home directory 
GOT SUBDIR ARG = 
Found data in C:\games\vegastrike\svn\win32\bin/../data
Using C:\games\vegastrike\svn\win32\data as data directory
CONFIGFILE - No config found in home : C:\Users\s\Documents/.vegastrike/vegastrike.config
CONFIGFILE - No home config file found, using datadir config file : C:\games\vegastrike\svn\win32\data/vegastrike.config
MISSION_NAME is empty using : main_menu.mission
running import sys
print(sys.path)
sys.path = ["",r"C:\games\vegastrike\svn\win32\data\modules\builtin",r"C:\games\vegastrike\svn\win32\data\modules\quests",r"C:\games\vegastrike\svn\win32\data\modules\missions",r"C:\games\vegastrike\svn\win32\data\modules\ai",r"C:\games\vegastrike\svn\win32\data\modules",r"C:\games\vegastrike\svn\win32\data\bases"] + sys.path
testing VS randomrunning import sys
print(sys.path)
  Initializing renderer...
Min (0.000000, 0.000000, 0.000000) Max(0.000000, 0.000000, 0.000000) MinLumin 1.000000, MaxLumin 1.000000Read In Star Count 0 used: 2000
Min (0.000000, 0.000000, 0.000000) Max(0.000000, 0.000000, 0.000000) MinLumin 1.000000, MaxLumin 1.000000Read In Star Count 0 used: 38
Loading a starsystem
Loading Star System Special/Empty
FOUND MODIFICATION = player FOR PLAYER #0
Stdout:

Code: Select all

 In path C:\games\vegastrike\svn\win32\bin
Windows version 6 1
Vega Strike  
See http://www.gnu.org/copyleft/gpl.html for license details.

Using .vegastrike as the home directory
On Linux the binary compiled from the same code runs without any problems.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: VS-current svn, compile error with VS Express 2012

Post by ezee »

Hi .
There is an option in the config file to allow more debug level .
It's under general , wait ....
<section name="general">
<var name="times_to_show_help_screen" value="-1"/>
<var name="dockingtime" value="20"/>
<var name="remember_savegame" value="false"/>
<var name="load_last_savegame" value="false"/>
<var name="write_savegame_on_exit" value="false"/>
<var name="debug_config" value="false"/>
<var name="debug_fs" value="3"/> <!-- set to 3 for most comprehensive debugging-->
<var name="default_mission" value="main_menu.mission"/>
<var name="galaxy" value="milky_way.xml"/>
<var name="yaw" value="0"/>
I use that actually to debug the video support

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: VS-current svn, compile error with VS Express 2012

Post by shenle »

Well by turning on debugging level 3 I get the attached stderr. It appears that the game is trying to load a bunch of files from the data directory, which aren't there. Even more, it is searching in paths which mix unix- and windows-style path separators, and I wonder if that's not a part of the problem. FWIW the precompiled vegastrike.exe from the svn repository does not have trouble finding its data files and runs correctly.
You do not have the required permissions to view the files attached to this post.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: VS-current svn, compile error with VS Express 2012

Post by shenle »

Well I was wrong, the binary from the svn also spews out a bunch of file not found errors.... but as opposed to the one compiled by me it runs properly and doesn't freeze. See attached stderr for the binary from svn.
You do not have the required permissions to view the files attached to this post.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: VS-current svn, compile error with VS Express 2012

Post by ezee »

I don't know what is your project with VS , but as you are a windows user i can help you .
But never more with another thing than the 0.5.1 rc1 from tag
I spent hours to try to build Vegastrike , and the only version working out of the box for windows && VC9 is :
https://sourceforge.net/p/vegastrikevo/ ... _0_5_1_r1/

It's my fork , you can find the original in the VS svn too .
But i would be happy to have a tester for Vegastrike evolved repositery .
:wink:

Anyway , you just need to checkout Data,vegastrike,vega-vc9 and win32 (or win64).
I have winXP sp3 and so i use win32 .
If you have vista or 7 and more use win64

You must copy the dll from win32/bin inside Data to run the game .
EDIT : In fact i mean grab all the files in win32 and paste idem in Data .
If you have MSVC2010 or > , launch the vc9 solution , 2010-2012 will make an updated project for you .
Good luck .

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
Post Reply