c++ - Including STL in static libraries -
i have created static library files alien.h , alien.cpp below. library linked file user.cpp. if 1 removes line comment, code compiles, links, , runs expected. is, library , program compile, program not link. msvc2015rc generates on 100 errors std::numeric_limits
being defined.
is there setting should aware of or msvc2015 bug?
file alien.h
#include <vector> // 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) defined in alien.obj
it bug! same library/program compiles under msvc2013 without language extensions enabled. in msvc2015, language extensions must enabled.
Comments
Post a Comment