-1

I've been trying to follow lazy foo's productions tutorial on sdl2 and I keep on running into the same issue. I made a template that links to the correct files and all and it worked for a while. But now when I create a project and include iostream for example, it tells me #using need c++/cli mode enabled.

So I then tried enabling it in the project settings but then it gave another error : "Cannot open metadata file iostream"

I tried : Rebuilding the project and solution

Cleaning the project and solution

I read this question and its answers : Visual studio - getting error "Metadata file 'XYZ' could not be found" after edit continue

Tried this too : IntelliSense: "#using" requires C++/CLI to be enabled

All of the above did not work

Community
  • 1
  • 1
mindoo
  • 1
  • 6

1 Answers1

1

Don't confuse #include, using and #using.

#using is used to import class libraries in C++/CLI, which is something you won't ever need unless you work with .NET libraries (but then usually you are better off just using C#, unless you are writing interop code).

#include is for including header files, which is what you normally do in "regular" C++. <iostream> is a regular standard library header, so you need #include (as in #include <iostream>).

using instead is used to bring names in the current scope (either the whole content of a namespace - as in the dreaded using namespace std;) or single names (as in using std::cout;). From C++11 it's also used to enable constructors inheritance and to create type aliases, but for the moment I don't think you need to worry about these uses.

But most importantly: please take the time to first learn the basics of the language from reputable sources before trying random stuff. All this #using mess wouldn't have arisen if you even just looked first at the classic hello would example you can find everywhere on the Internet.

Matteo Italia
  • 123,740
  • 17
  • 206
  • 299