看一下我配置完的运行结果:

1)首先创建一个项目。

2)选择win项目和C语言

3)然后找到你保存项目的文件夹里面拷贝两个.c和.h文件,两个文件代码我附在最后。
4)现在还不能用,找到项目属性

5)打开参数,点开连接,你可以看到我已经粘贴进去了
如果你是64位和我一样的话那就粘贴下面的两个其中一个(因为我的电脑这些文件位置不一样)
A种)
C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/libwinmm.a C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/libmsimg32.a C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/libkernel32.a C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/libuser32.a C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/libgdi32.a C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/libole32.a C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/liboleaut32.a C:/Program Files/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/libuuid.a
B种)
"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib/libwinmm.a"
"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32/libgdi32.a"
"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32/libkernel32.a"
"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32/libmsimg32.a"
"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32/libole32.a"
"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32/liboleaut32.a"
"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32/libuser32.a"
"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32/libuuid.a"

6)你现在可以把你在主函数里面自动生成的代码全部删掉,注意是主函数哈,不是那两个要你复制过去的文件。删掉后你就可以做你自己事情,写你的图形了
我的main函数代码:
#include "acllib.h"
#include<stdio.h>
int Setup()
{
initConsole();
printf("输入宽度:");
int width;
scanf("%d", &width);
initWindow( "text",100,100, 600, 500);
beginPaint();
line(20, 20, width-20, width-20);
endPaint();
return 0;
}
下面是两个文件
PS:简单说个前提,也就是我在配置的过程中遇到的问题
在文件里面有些dev配置不一样,导致会报错,所以当你报错的时候可以选择注释掉报错的那一行或者把我注释掉的代码给释放出来
有些比如这个是acllib.c里面的,被我注释掉,因为我dev报错 了,如果你报错了,你也可以试试释放出来
也比如说acllib.h文件里面,两个函数也被我注释掉了,在我dev里面报错了,如果你用了也会报错那么你试试把代码释放出来看看行不行。

acllib.c(记得文件名不能修改,只能叫acllib然后选择.c文件)
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// ACLLib - Advanced C Lab Library
// Ver. 2014-07
// For Students' Lab at Zhejiang University
// Created 2008 by Gao Yuan
// Modified 2009 by Cui Liwei
// 2010 by Lan Huidong
// Revised 2012 by Li Rui
// Modified 2014 by Weng Kai for MOOC
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NON_CONFORMING_SWPRINTFS
#define CINTERFACE
#ifdef _UNICODE
#undef _UNICODE
#endif
#ifdef UNICODE
#undef UNICODE
#endif
#include "acllib.h"
#include <windows.h>
#include <olectl.h>
#include <stdio.h>
#ifdef _MSC_VER
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"msimg32.lib")
#endif
#ifdef _DEBUG
#define ACL_ASSERT(_Expression,errStr) (void)( (!!(_Expression)) || (acl_error(errStr),0) )
#else
#define ACL_ASSERT(flag,errStr) ((void)0)
#endif
#define ACL_ASSERT_HWND ACL_ASSERT(g_hWnd!=0, \
"You should call function \"initWindow(...)\" befor use function \"" __FUNCTION__ "\"" )
#define ACL_ASSERT_BEGIN_PAINT ACL_ASSERT(g_hmemdc!=0, \
"You should call function \"beginPaint()\" befor use function \"" __FUNCTION__ "\"" )
// f
int Setup(void);
const char g_wndClassName[] = "ACL_WND_CLASS";
const char g_libName[] = "ACLLIB";
HINSTANCE g_hInstance;
HWND g_hWnd = NULL;
HDC g_hmemdc = NULL;
HBITMAP g_hbitmap = NULL;
int g_wndHeight;
int g_wndWidth;
HPEN g_pen = NULL;
ACL_Color g_penColor = BLACK;
int g_penWidth = 1;
int g_penStyle = PEN_STYLE_SOLID;
HBRUSH g_brush = NULL;
ACL_Color g_brushColor = BLACK;
int g_brushStyle

最低0.47元/天 解锁文章





