1

I'm trying to compile the following code using Codebloks Nightly svn 9916

#include "Main.h"
#include <iostream>

using namespace std;

int main() {

    cout << "Hello World!" << endl;
    return 0;
}

Running the executable from inside Codeblocks, it returns Hello World! as expected to. But if the executable is started from outside it returns an application error 0xc000007b. It means that either the System type (32bit or 64bit) doesn't fit, or that the executable is broken. But I don't understand why the the compilation is fine while executing from Codeblocks. The executable itself is 32bit (x86) and running it from a 32bit or 64bit cmd doesn't make a change.

Data: Windows 7 Professional 64 Bit GNU GCC Compiler

EDIT: Workarround

Statically linking the c++ library against the executable works. It seems like windows can't execute it if the c++ standard library isn't available.

Matze
  • 533
  • 7
  • 16

2 Answers2

1

Statically linking the C++ default library works.

Just add -static-libstdc++ to your linking statement

Matze
  • 533
  • 7
  • 16
0

I would recommend setting up your compiler again from statch to see if that is causing the issue, I would recommend watching this video at it pretty much describes how to do it from step 1.

GingerPlusPlus
  • 5,336
  • 1
  • 29
  • 52
DarkEvE
  • 171
  • 12