[英]FLTK-1.1.10 with Microsoft Visual C++ 2010 Express
I'm attempting to follow Programming - Principles and Practice Using C, and am loving it so far. 我正在尝试遵循编程-使用C的原理和实践,并且到目前为止我仍然很喜欢它。 At the start of last week, I hit a problem that has stopped further progress. 上周初,我遇到了一个问题,该问题已停止进一步发展。 I'm required to install FLTK. 我需要安装FLTK。
After successfully managing to build and run FLTK-1.3.0 (see my other question/solution), I've run into the problem that it doesn't run with Stroustrup's header files. 在成功地构建并运行FLTK-1.3.0(请参阅我的其他问题/解决方案)之后,我遇到了它不能与Stroustrup的头文件一起运行的问题。 I think this is due to the versions being different, but don't know for sure. 我认为这是由于版本不同而引起的,但不确定。
So I'm back to trying to get 1.1 working. 所以我回到尝试使1.1开始工作的地方。
I've not managed to be able to build FLTK-1.1.10 or the fltk-1.1.9 from his website using MVC++2010. 我无法使用MVC ++ 2010从他的网站构建FLTK-1.1.10或fltk-1.1.9。
So this leads us to the questions 所以这引出了我们的问题
1) If I build it using MinGW/Msys, will it still be able to be run from VC++? 1)如果我使用MinGW / Msys构建它,它是否仍可以从VC ++运行? I've been trying to figure out MinGW/Msys with little success so far, so I've yet to build anything, so I can't test this myself yet. 到目前为止,我一直在尝试找出MinGW / Msys并没有取得太大的成功,所以我还没有构建任何东西,所以我自己还无法测试。
2) If it won't run a MinGW build, is there a way to build it with VC++? 2)如果它将无法运行MinGW构建,是否可以使用VC ++构建它?
From my understanding -Building will create more files in the FLTK directory that will allow me to use it. 从我的理解-Building将在FLTK目录中创建更多文件,使我可以使用它。 -MinGW uses a different compiler to VC++ and they won't play well together -MinGW使用与VC ++不同的编译器,它们不能很好地配合使用
I feel I've wasted a lot of time on this section, however it's a good learning experience. 我觉得我在这部分上浪费了很多时间,但是这是一个很好的学习经验。 Probably not so good for my blood pressure. 对我的血压可能不太好。
I guess at this point my main alternative is to move to another IDE. 我想在这一点上,我的主要选择是移至另一个IDE。 Eclipse seems pretty nice. Eclipse看起来非常不错。 But I'd really like to solve this problem rather than move away from VC++. 但是我真的很想解决这个问题,而不是放弃VC ++。
My previous post ( Microsoft 2010 visual c , installing FLTK ) details the errors that occur during compile, in case that is of any interest. 我的上一篇文章( Microsoft 2010 visual c,安装FLTK )详细介绍了在编译过程中发生的错误(如果有兴趣的话)。
I've heavily googled this issue, and have yet to find a real solution. 我已经在这个问题上进行了大量的搜索,但尚未找到真正的解决方案。 I hope this post will clarify the issue for myself and other future programmers. 我希望这篇文章能为我自己和其他未来的程序员澄清这个问题。
Well, it's taken me long enough, but I've finally got it all figured out. 好吧,这花了我足够长的时间,但我终于明白了。 This appears to be the lay of the land. 这似乎是一块土地。
After all the frustration I had getting these all working, I think it's only fair to write up a step by step guide for people who may be in similar situations. 经历了所有的挫折之后,我认为为可能处于类似情况的人们写一份逐步指南是很公平的。 The book is aimed at novice programmers, not people already able to debug his header and cpp files. 本书面向的是新手程序员,而不是已经能够调试其标头和cpp文件的人员。 I apologize is the solution is a little lengthy, but I think it's only appropriate for people like myself who are likely to be facing it. 抱歉,解决方案有点冗长,但是我认为这仅适用于像我这样可能会遇到的人。
Visual Express 2008 / 2010 guide Visual Express 2008/2010指南
1) Build FLTK. 1)建立FLTK。 Not as easy as it sounds, but not too bad. 听起来并不那么容易,但还算不错。 In 2008 use FLTK 1.1.0. 在2008年使用FLTK 1.1.0。 In 2010 use 1.3.0. 在2010年使用1.3.0。
For 2010 see the solution I wrote here – Microsoft 2010 visual c , installing FLTK 对于2010,请参阅我在此处编写的解决方案-Microsoft 2010 visual c,安装FLTK
For 2008 run C:\\fltk-1.1.10\\vc2005\\fltk.lib.vcproj instead. 对于2008年,请运行C:\\ fltk-1.1.10 \\ vc2005 \\ fltk.lib.vcproj。
If there are any errors during the build process, you will need to figure out what the problem is. 如果在构建过程中出现任何错误,则需要找出问题所在。
2) Set up a new project 2)建立一个新项目
3) Run a test programme to make sure your FLTK is working properly, try - 3)运行测试程序以确保您的FLTK正常运行,请尝试-
#include <FL/Fl.h>
#include <FL/Fl_Window.h>
int main()
{
Fl_Window win(320,200);
win.show();
return Fl::run();
}
If there are any errors here, then you won't be able to proceed. 如果此处有任何错误,则将无法继续。
4) Put the files from his website into the right folders. 4)将他网站上的文件放到正确的文件夹中。
5) Add the .h and .cpp files to your active project. 5)将.h和.cpp文件添加到活动项目中。
6) Now you will find that if you run the project, you'll get a bunch of errors, the most important reads - 6)现在,您将发现,如果您运行该项目,则会遇到很多错误,最重要的内容是-
c:\\users\\user\\documents\\visual studio 2010\\projects\\fri_fltk_test\\graph.cpp(237): error C2084: function 'Graph_lib::Circle::Circle(Point,int)' already has a body c:\\ users \\ user \\ documents \\ Visual Studio 2010 \\ projects \\ fri_fltk_test \\ graph.cpp(237):错误C2084:函数'Graph_lib :: Circle :: Circle(Point,int)'已经具有主体
7) We can fix this by opening Graph.cpp and commenting out the Circle::Circle section, like - 7)我们可以通过打开Graph.cpp并注释掉Circle :: Circle部分来解决此问题,例如-
//Circle::Circle(Point p, int rr) // center and radius
//:r(rr)
//{
// add(Point(p.x-r,p.y-r)); // store top-left corner
//}
8) Save changes and run your project again, you should find that it works! 8)保存更改并再次运行您的项目,您应该发现它可以工作! 9) Now the best part, put in the code from the book (or copy it from – Chapter13/chapter.13.2.cpp and run it! It should work. 9)现在最好的部分是,从书中放入代码(或从– Chapter13 / chapter.13.2.cpp复制并运行它!它应该可以工作。
Mission complete! 任务完成!
Think I deserve a beer after that! 认为之后我应该喝啤酒! Took me a ton of time to figure it all out, took a look at Msys, g++ , Netbeans and a load of other IDE related things. 我花了很多时间弄清楚了所有这些,并看了一下Msys,g ++,Netbeans和许多其他与IDE相关的东西。 But it's a nice feeling to have it working on my original choice. 但是让它按我原来的选择工作是一种很好的感觉。 I hope this guide helps others in similar situations. 我希望本指南可以帮助处于类似情况的其他人。
Special thanks go out to Skydiver from the Dream.In.Code forums for his help with this problem. 特别感谢Dream.In.Code论坛上的跳伞运动员在此问题上的帮助。
Could it be because you are running the Express edition? 可能是因为您正在运行Express版本吗? I've encountered similar problems like that and had to switch to an older version of Express. 我遇到过类似的问题,因此不得不切换到旧版的Express。
Have you seen this post? 你看过这个帖子吗?
http://answerpot.com/showthread.php?275672-FLTK+%26+Visual+C%2B%2B+Express%3F http://answerpot.com/showthread.php?275672-FLTK+%26+Visual+C%2B%2B+Express%3F
-Si. -Si
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.