App built with code::blocks only runs from code::blocks

0

I have built an application with code::blocks. It runs fine when I run it from code:blocks ( Ctrl-F10 ). When I run it by double-clicking in file explorer or from a command prompt I get "The application was unable to start correctly (0xc000007b)"

What is different when I run an application in code::blocks with Ctrl-F10, compared to the other methods of running an application?

I understand the error number has something to do with 64 and 32 bit applications. My application and my OS are 64 bit.

I have built and run successfully several other applications. The only significant difference with this one is that it incorporates the NDI SDK from NewTek https://www.newtek.com/

Here is the code:

#include <iostream>
#include <Processing.NDI.Lib.h>
#include <nana/gui.hpp>

using namespace std;

int main()
{
    if (!NDIlib_initialize())
        throw std::runtime_error("Cannot initialize NDI");

    NDIlib_find_instance_t pNDI_find = NDIlib_find_create_v2();
    if (!pNDI_find)
        throw std::runtime_error("Cannot initialize NDI");

    nana::form fm(nana::rectangle( 100,100, 300, 300 ) );
    fm.show();
    nana::exec();

    return 0;
}

Here are the build commands:

        g++.exe -Wall -fexceptions -m64 -std=c++11 -O2 
    -I"C:\Program Files\NewTek\NewTek NDI 3.8 SDK\Include"
     -IC:\Users\James\code\nana-1.7.0\include 
    -c C:\Users\James\code\VisControl\ndi\test\main.cpp -o obj\Release\main.o

        g++.exe -L"C:\Program Files\NewTek\NewTek NDI 3.8 SDK\Lib\x64" 
-LC:\Users\James\code\nana-1.7.0\build\codeblocks 
-o ..\..\bin\test.exe obj\Release\main.o  
-static-libgcc -m64 
-s  "C:\Program Files\NewTek\NewTek NDI 3.8 SDK\Lib\x64\Processing.NDI.Lib.x64.lib"
 -lnana -lgdi32 -lcomdlg32 -lstdc++fs
codeblocks
asked on Stack Overflow Mar 26, 2019 by ravenspoint • edited Mar 26, 2019 by ravenspoint

1 Answer

0

The problem went away when I add the linker option -static

answered on Stack Overflow Mar 26, 2019 by ravenspoint

User contributions licensed under CC BY-SA 3.0