0

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.

2
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by UltimateKnight
0

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"?

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

fatal error LNK1169: one or more multiply defined symbols found

Edited by UltimateKnight: n/a

0

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 by Narue: n/a

0

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 by UltimateKnight: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.