undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status

前端 未结 3 1862
天命终不由人
天命终不由人 2020-12-18 01:32

I am using eclipse CDT to test the Intel instructions and below is my program:

#define cpuid(func,ax,bx,cx,dx)\\
__asm__ __volatile__ (\"cpuid\":\\
 \"=a\" (         


        
相关标签:
3条回答
  • 2020-12-18 02:15
    1. The main() function is missing.
    2. Save as this code as some new file. Again run to compile the code.
    3. Check the PATH environment variable.
    0 讨论(0)
  • 2020-12-18 02:16

    Your program isn't complete. You need to implement the OS-expected entry point. In your case, that looks like it's called WinMain.

    0 讨论(0)
  • 2020-12-18 02:17

    Yes, Main () function is missing and the compiler is not able to find an entry point for executing the program.

    One more reason is even if you have written the main function but if you didnot save the .cpp file and try to compile it will give the same error.So make sure you have successfully saved the .cpp file and then compile and run your code.

    Hope this will help since I have faced similar issue and I spent around hours to figure it out , Thanks

    0 讨论(0)
提交回复
热议问题