News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

C::B won't compile any of my existing code

Started by stugol, January 02, 2014, 03:39:18 AM

Previous topic - Next topic

stugol

I dunno if I'm doing something wrong here, but I can't for the life of me get Code::Blocks to compile existing code that compiles fine in VS2012.

Includes like strsafe.h and xstring cause weird compilation errors, the strangest of which is a "missing close bracket" in the middle of a standard include file. Needless to say, there is no missing bracket. Further, move.h causes C::B to throw up with "fatal error: expected function body after function declarator".

Guard clauses like
#ifndef _FUNCTIONAL_
#error Must include <functional>
#endif

throw errors even though functional has been included.

Now, quite possibly it's the compiler at fault (clang), but I get insane errors with "GCC" and "Microsoft Visual C++ 2010" compilers as well - just different insane errors. What am I doing wrong?

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

oBFusCATed

Quote from: stugol on January 02, 2014, 03:39:18 AMWhat am I doing wrong?
You've used the wrong compiler to write portable code :)

Also you're using non-standard headers and expect them to be available in all compilers (strsafe.h, xstring)?
Quote
<xstring> is a Microsoft C++ header containing the actual implementation of the std::basic_string template. You never need to include that file on your own. <string> includes it for the basic_string implementation.

Keep in mind that these are questions out of the scope of the forum and your topic can be locked. If you want to understand why, just re-read the rules!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]