Reputation: 2534
I have created a static library with the files alien.h and alien.cpp below. That library is linked by the file user.cpp. If one removes the line with the comment, then the code compiles, links, and runs as expected. As it is, the library and the program compile, the program however does not link. MSVC2015RC generates over 100 errors about std::numeric_limits
being already defined.
Is there some setting that I should be aware of or is this a MSVC2015 bug?
File alien.h
#include <vector> // This line causes troubles.
struct alien
{
const int * const value;
};
extern alien meh;
File alien.cpp
alien meh { 7 };
File user.cpp
#include "alien.h"
#include <iostream>
#pragma comment(lib, "alien.lib")
int main()
{
wcout << meh.value;
return 0;
}
Error LNK2005 "public: static int const std::numeric_limits::max_exponent" (?max_exponent@?$numeric_limits@M@std@@2HB) already defined in alien.obj
Upvotes: 2
Views: 987