I am using Microsoft Visual C++ Express 2008 edition and notice some code is not working in here. There are different functions and some headers are not recognized while in other are. So is the compiler not good? I've heard about Dev C++ and Turbo C++ but haven't tried them. Reccomendations about compilers for C++ - don't have to be free. Thanks.

So is the compiler not good?

The compiler that ships with Visual C++ is quite good. Your problem is very vague, but I suspect you're trying to use non-portable stuff. Can you give an example of what code "is not working"?

// ask for a person's name, and generate a framed greeting
#include <iostream>
#include <string>
int main()
{
std::cout << "Please enter your first name: ";
std::string name;
std::cin >> name;
// build the message that we intend to write
const std::string greeting = "Hello, " + name + "!";
// build the second and fourth lines of the output
const std::string spaces(greeting.size(), ' ');
const std::string second = "* " + spaces + " *";
// build the first and fifth lines of the output
const std::string first(second.size(), '*');
// write it all
std::cout << std::endl;
std::cout << first << std::endl;
std::cout << second << std::endl;
std::cout << "* " << greeting << " *" << std::endl;
std::cout << second << std::endl;
std::cout << first << std::endl;
return 0;
}

fatal error LNK1169: one or more multiply defined symbols found

Edited 5 Years Ago by UltimateKnight: n/a

I'd say you have other stuff in the project that's conflicting. The code is conforming (I recognize it from Accelerated C++), and builds just fine on a fresh project in Visual Studio 2008. Try creating a new project and see if you still get the error.

Edited 5 Years Ago by Narue: n/a

Hmm, weird just got the Microsoft Visual C++ 2010 Express and works fine.. Atleast this code..

EDIT : Yes it's from Accelerated C++ and it says there that should work fine.

Edited 5 Years Ago by UltimateKnight: n/a

This article has been dead for over six months. Start a new discussion instead.