Search code examples
c++bashgcc-warning

-bash ./foo: No such file or directory after compilation


I'm compiling a program named benchmark_Quickthread_01.cpp:

#include <quickthread/QuickThread.h>
#include <iostream>
using namespace qt;

int main()
{
  qtInit qtInit( -1 );

  std::cout << "Blub\n" << std::endl;
  return 0;
}

with compiler options:

g++ -L /usr/local/lib64/ -static ./benchmark_Quickthread_01.cpp -lQuickThread 
-o qt.exe -pthread -Wl,-Bdynamic -lnuma -ldl -lrt -Wall

compiler gives no errors. However when I try running the file, bash gives me following error:

-bash: ./qt.exe: No such file or directory

File exists, I can ls, cat and check size ('du -h qt.exe' = 272K)

What might cause the problem?


Solution

  • -static and -Wl,-Bdynamic are conflicting. Remove one or the other, and try again.