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.

Recommended Answers

All 6 Replies

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;
}

And what error do you get?

fatal error LNK1169: one or more multiply defined symbols found

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.