最白目
最白目

Reputation: 3654

Which Compiler can I use?

I have to import and work with a C++ Project. However, I can´t get it to run without Microsoft Visual Studio. The Author of the project told me, I have to use a Microsoft Compiler, because only this one can handle particular notations he used (e.g. creating Objects on the fly while passing it to a method). See example.

lights.push_back(Light(Vector(dirx,diry,dirz).normalize(), Color(colr, colg, colb)));

I had to create an vector object before and pass it to the method.

Can anyone tell me which compiler I can use? I dont have enough bit flow to download 3 gb Visual Studio. Great but not necessary would be a compiler that I can use on Mac OS.

cheers.

Upvotes: 2

Views: 218

Answers (2)

Matthieu M.
Matthieu M.

Reputation: 300439

If you are working on Mac OS, then the default compiler is (for recent version) Clang (based on LLVM).

And you are lucky in that Clang has a compatibility mode for parsing MSVC code that is normally quite advanced. The current top of the tree version is able to parse near every MFC generated header for example.

You can activate this mode using -fms-extensions.

Upvotes: 2

Michael Burr
Michael Burr

Reputation: 340516

Any C++ compiler can 'create objects on the fly while passing it to a function' (these are often known as temporary objects or rvalues).

What Visual C++ can do that other C++ compilers generally can't is pass those temporary objects to functions through parameters that are non-const references. The C++ standard specifically forbids that behavior, but MSVC allows it (Microsoft calls it an extension).

I'm guessing that that is the behavior the Author of the project is depending on.

Upvotes: 9

Related Questions