babelproofreader
babelproofreader

Reputation: 552

<algorithm> won't compile on Dev C++ compiler

I am trying to port some code using the Dev_C++ 4.9.9.2 compiler and I cannot get it to recognise the standard algorithm template as in

#ifdef __cplusplus
extern "C" {
#endif

#include <algorithm>
#include <string>
using namespace std;

Whenever I attempt to compile I get numerous error messages, the majority saying "template with C linkage." What am I doing wrong? Is there some setting I need to adjust on the compiler.

Tech Specs - I am running the compiler on Windows XP SP3 on Oracle VirtualBox, which in turn is on a Ubuntu 10.10 AMD64 host machine.

Upvotes: 0

Views: 901

Answers (1)

babelproofreader
babelproofreader

Reputation: 552

The answer seems to have been given in an answer that has now been deleted: move the includes outside the extern "C" { braces

using namespace std ;
#include <algorithm>
#include <string>

#ifdef __cplusplus
extern "C" {
#endif

This compiles without error messages.

Upvotes: 1

Related Questions