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.

3
  • 2
    You probably need one or more of the gcc dll files in your path or in the directory where the executable is. Dependency Walker can be helpful to see what's missing. Commented Oct 3, 2014 at 11:18
  • Main.h is just a blank autogenerated header Commented Oct 3, 2014 at 11:25
  • @Matze: When you found the solution, post it as answer. Commented Oct 4, 2014 at 11:12

2 Answers 2

1

Statically linking the C++ default library works.

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

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.