要做Dev C++编写C语言的Project,引用了一个外部的garphics.h库,我直接文件->新建->源代码,然后编写,但是编译时出现undefined reference to `WinMain'和[Error] ld returned 1 exit status
老师说建项目的时候,建win32 api项目,不要建console项目。
这是什么意思?还有win32 api 该怎么建?
代码如下(已#include"genlib.h" #include"graphics.h",把genlib.h genlib.c graphics.h graphics.c和自己的代码放在一个文件夹了)
/*
*File: Draw a house.c
*--------------------
*This program draws a house.
*/
#include<stdio.h>
#include<math.h>
#include"genlib.h"
#include"graphics.h"
void DrawSquare(double x,double y,double r);
void DrawRegularTriangle(double x,double y,double a);
int main(void)
{
InitGraphics();
DrawSquare(1,1,6);
DrawSquare(7,1,6);
DrawSquare(13,1,6);
DrawSquare(19,1,6);
DrawSquare(1,7,6);
DrawSquare(7,7,6);
DrawSquare(13,7,6);
DrawSquare(19,7,6);
DrawSquare(7,13,1);
DrawSquare(9,13,1);
DrawSquare(11,13,1);
DrawSquare(13,13,1);
DrawSquare(15,13,1);
DrawSquare(17,13,1);
DrawRegularTriangle(1,13,6);
DrawRegularTriangle(19,13,6);
return 0;
}
void DrawSquare(double x,double y,double r){
MovePen(x,y);
DrawLine(0,r);
DrawLine(r,0);
DrawLine(0,-r);
DrawLine(-r,0);
}
void DrawRegularTriangle(double x,double y,double a){
MovePen(x,y);
DrawLine(a/2.0,a/2.0*sqrt(3));
DrawLine(a/2.0,-a/2.0*sqrt(3));
}
