0

When attempting to create a .h file in order to store a class such as in the example below:

#ifndef TRIANGLE64_H
#define TRIANGLE64_H

class Triangle64{
public:

 Triangle64();

 double getArea();

 void destroy(); //Frees the allocated memory

private:

//Variables reflecting the properties of the triangle
 double Base;
 int N_ulps;
 double s;
 double Area;
};

#endif

I am returned with the error:

This version of C:\Users\ezio1\AppData\Local\Temp\Triangle64.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

Which seems quite strange as I am not attempting to make a .exe file from this code (and for completeness I am also running Windows 10 with the gcc compiler).

I have also tried ignoring the error message and attempted to create a class file from the header:

#include "Triangle64.h"

//Constructor
Triangle64::Triangle64(){

}

However, the code does not even run this time and I am returned with the error message

c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status

Could this be a result of an issue with my installation of the compiler or perhaps something to do with the OS?

  • There's other code that's missing and you haven't shown us how you're trying to build the application. Including the makefile or command line used would be good. For the second problem see http://stackoverflow.com/questions/5259714/undefined-reference-to-winmain16/5260237#5260237 – Captain Obvlious Jan 25 '17 at 03:09
  • Add the -m64 / -m32 flags to your link line. Could you display the link command here? – london-deveoper Jan 25 '17 at 03:21
  • Please post a MCVE for the first error, and also please try to describe your problem better. You left out a lot of steps between "type in the .h file" and "returned with an error". First you say you are not trying to create an EXE file,but later you seem to have tried to compile and run the code. (You cannot compile and run without creating an EXE file) – M.M Jan 25 '17 at 04:51

1 Answers1

-1

It looks like you're building a 16-bit application, based on the second error message. 64-bit versions of Windows can't run 16-bit executables due to a limitation of the x86 architecture.

Change your compiler settings to build 32-bit or 64-bit code.

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622