Never mind. It has been a while since I've used VS and forgot that it doesn't necessarily treat cpp files as c++. I had to set the "compile as" option to c++.
VS2012 mixing C and Cpp, library clash
-
02-04-2022 - |
Question
I am trying to combine some C and C++ code in a project, and before I had no issues with this, but I'm now trying out VS2012 for the first time and I get a lot of errors from a TR1 header that I didn't include explicitely.
I'm thinking it might be a mixup because it's trying to compile my c code with this cpp header. It looks like a C compiler error trying to understand C++ template code. Where can I figure this out from the VS2012 interface? Do I need to do something to my c and cpp files to make the compiler treat them properly?
Error 1 error C2143: syntax error : missing '{' before '<' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtr1common 15 1 example~
Error 2 error C2059: syntax error : '<' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtr1common 15 1 example~
Error 3 error C2143: syntax error : missing '{' before '<' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtr1common 20 1 example~
Error 4 error C2059: syntax error : '<' C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtr1common 20 1 example~
Error 5 error C2016: C requires that a struct or union has at least one member C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtr1common 28 1 example~
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow