Author Topic: C::B won't compile any of my existing code  (Read 10466 times)

Offline stugol

  • Single posting newcomer
  • *
  • Posts: 2
C::B won't compile any of my existing code
« on: January 02, 2014, 03:39:18 am »
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
Code
#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?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B won't compile any of my existing code
« Reply #2 on: January 02, 2014, 01:06:56 pm »
What 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!]