[英]C++ header file gives Windows incompatability error
When attempting to create a .h file in order to store a class such as in the example below: 尝试创建.h文件以存储类时,例如下面的示例:
#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.
此版本的C:\\ Users \\ ezio1 \\ AppData \\ Local \\ Temp \\ Triangle64.exe与您正在运行的Windows版本不兼容。 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). 这似乎很奇怪,因为我没有尝试从此代码中创建.exe文件(为了完整起见,我还使用gcc编译器运行Windows 10)。
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
c:/ mingw / bin /../ lib / gcc / mingw32 / 5.3.0 /../../../ libmingw32.a(main.o):(。text.startup + 0xa0):未定义引用`WinMain @ 16'collect2.exe:错误:ld返回1退出状态
Could this be a result of an issue with my installation of the compiler or perhaps something to do with the OS? 这可能是由于我的编译器安装出现问题,还是与操作系统有关?
It looks like you're building a 16-bit application, based on the second error message. 看起来您正在根据第二条错误消息构建一个16位应用程序。 64-bit versions of Windows can't run 16-bit executables due to a limitation of the x86 architecture.
由于x86体系结构的限制,Windows的64位版本无法运行16位可执行文件。
Change your compiler settings to build 32-bit or 64-bit code. 更改编译器设置以生成32位或64位代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.