The executable with clang ++ is going crazy

#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
using namespace std;

class Book{
    public:
        int a;
        int b;
};

int main()
{
    Book b1;
    b1.a = 10;
    b1.b = 20;
    cout<< b1.a << " " <<b1.b;
}

when we compile the above code with

clang++ test.cc -o a.exe

and run a.exe perfectly. But when we compile the same program with

clang++ test.cc -emit-llvm -S -o a.exe

and now, when we launch it, the program is going crazy, having started ntvdm.exe(you can see it in the process explorer), and the command line starts to behave strangely.

Software Stack:

clang version 2.9 (tags/RELEASE_29/final)
Target: i386-pc-mingw32
Thread model: posix
+5
source share
1 answer

By adding "-emit-llvm -S", you are not generating machine code, but LLVM byte code. To run this, you need to use lli .

ntvdm.exe - DOS- , , Windows - LLVM 16- DOS .

+9

All Articles