Reputation: 4783
So I'm pretty stumped here. I have a Library "A" that I wrote in C++ with VS2013, and can successfully include and build it within project "X".
Project "X" is an MFC app also developed in VS2013, and its Platform Toolset
value is set to VS2013
. It happens to be a Win32 application.
I now have to include the library in a different project "Y" (which was a VS2010 project, but I (believe I) converted it using VS to 2013).
Project "Y" is NOT an MFC app, instead a .dll, and its Platform Toolset
value is also set to VS2013
. It is an x64 application.
However, when I try to build "Y", I get tons of compiler errors, mostly because the library uses C++11 features, and apparently VS isn't allowing it. The errors are mostly vector bracket-initialization syntax problems. E.G. non-aggregates cannot be initialized with initializer list
. But in addition, it also can't find symbols for strtoll
and report_rangecheckfailure
.
But I don't understand. To my knowledge, VS2013 should support these features, and it appears to in my other projects. What could be the issue here? Is there something else I need to do to use the 2013 compiler?
Edit Just to be extra clear, it's assignments like this that give the aggregate compiler message:
std::vector<std::string> paramVector = { "username", "time", "hours", "udata" };
Upvotes: 0
Views: 192
Reputation: 941217
it also can't find symbols for strtoll and report_rangecheckfailure
Strongest hint towards the underlying problem, those would be linker errors. So one hard fact is evident: you are not linking the VS2013 C runtime library. These symbols exist in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\libmsvcrt.lib and libcmt.lib but not in earlier versions, like the VS2010 version.
From there it is but a very short hop to explain the "non-aggregates cannot be initialized with initializer list" error. Clearly you are also not including the appropriate VS2013 <vector>
include file. Required to get that vector assignment to compile. Again, including the VS2010 version of it explains that error.
Rock-hard fact: your Y project is not configured correctly.
Getting it wrong both for the compiler and the linker does point squarely at the toolset target setting, even though you think it is correct. A standard mistake would be to change the setting for the Debug configuration but forgetting to also do it for the Release configuration. Having the Project > Properties > VC++ Directories set wrong would be another way. The compiler's /showIncludes and the linker's /verbose options give you enough feedback to verify your assumptions. If you're absolutely desperate then recreate the Y project.
Upvotes: 3
Reputation: 5369
One of possible reasons is that C++11 is partially supported by VS2013, see this table for details https://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
And anyway, it's better to show an example of the errors you got so far.
Upvotes: 0