development

libQGLViewer compile

toyship 2014. 3. 19. 12:17
반응형

CGAL예제들을 컴파일 하는데, QGLViewer라는놈이 없어서 안되는 놈들이 있더라.

까지것 QGLViewer 설치해 주지...

.

.

.

하지만, 이놈을 설치하는데 하루가 걸렸다.

나같이 삽질하시는 분들이 없기를 바라는 맘에 글을 남긴다.

 

우선 libGQLViewer는 소스로 배포가 된다.

내가 받아서, 컴파일 해야 한다.

 

근데, 이놈을 컴파일 하는 방법중에서

- make로 하는 방법... 실패했다.

- QT Editor로 하는 방법.... 실패했다.

고민하다가, Visual studio로 하는 방법이 있다는걸 알았다.

 

우선, Visual studio addin for QT 를 설치하면,

Visual studio에서 QT 프로젝트를 읽어서, visual studio 프로젝트 파일을 만들어 준다.

오호~~

 

그러나, 컴파일 하면, 에러가 난다....

그럼, gqlviewer.h 파일을 열어서 아래처럼 한줄을 넣어주면 된다.

 

 

아.... 컴파일이 된다.. ^^;

 

 

 

아래는 참고 할 사이트 내용이다.

http://prasnuts.free.fr/index.php/tutorials/how-to/17-installing-qglviewer-for-development-in-windows

 

Installing QGLViewer For Development In Windows

If you are planning to do 3D graphic development using OpenGL, then GLUT and QGLViewer are two things you would want to have in your armoury.

This tutorial presents how to configure QGLViewer for development in Visual Studio. (Couldn't have done this without the support of my dear colleague Vadim Macagon. Thank you very much for the helping hand.)

System Configuration:

Windows 7 Family Premium Edition – Service Pack 01

Visual Studio 2010 Professional

Here we go...

Step 01: Download the QGLViewer libraries and unzip them

Latest version (2.3.13 in early 2012) of QGLViewer can be found here. Using the installer is no good since it doesn’t provide us with the QGLViewer2.dll which will be used in development. Hence, the source zip archive should be downloaded and unzipped.

 

Step 02: Compiling QGLViewer Project

It’s assumed that you have already installed Qt Visual Studio add-in. If not please make sure to install it and it could be found here.

From the unzipped source folder copy the whole directory and all its content to another directory of your choice. (It’s advised to copy it to a folder like C:\ProgramFilesXXX\ (With no spaces in between) as it is going to be treated as an installed software.) In my machine the root of the directory looks like this. C:\ProgramFilesPras\libQGLViewer-2.3.15

Open Visual Studio and open the QGLViewer.pro file not the (libQGLViewer-2.3.15.pro) that you find inside the ..\libQGLViewer-2.3.15\QGLViewer folder using the add-in and build the project. The chances are that you would get compilation errors. (I got 20 of them) Don’t panic! You should be able to get it to compile in single step.

Check whether your first error message resembles something like the following. “error C3861: 'gluProject': identifier not found”. We could get rid of that and all the other by including glu.h header file in the project.

Open qglviewer.h file and add #include <GL/glu.h> just after the #include "camera.h" line. Then build the project again. Everything should go fine.

Then change the Debug option Release and build the project again. Building in the Release mode is also important since if not, you would not be able to make a “release build” of your final software.

 

Step 03: Verifying the output.

If everything happened as expected, then inside the debug folder you should have a dll named “QGLViewerd2.dll”. Also you should have another dll called “QGLViewer2.dll” inside the release folder.

The debug folder looks like this.

 

Debug folder of QGLViewer

Debug Folder Of QGLViewer

 

 

 

Step 04: Create an environment variable for QGLViewer

Create an environment variable called QGLDIR and set its path to your installation root folder. If you follow the instructions it should be “C:\ProgramFilesXXX\libQGLViewer-2.3.15 ”.

If you have a doubt about creating an environment variable please refer to one of the many tutorials available in the web. Then add that to your PATH environment variable.

 

Step 05: Installing QGLViewer dynamic linker

The dynamic linking library (.dll) should be put in a place where it could be found at runtime. In windows environment we have 5 choices which are

01. Inside the directory where the exe of your software is (So, in our case that would be inside your debugand release folders of the project folders you are working)

02. Inside the root directory of you project folders

03. Inside the Windows systems directory. System32 or SysWow64 depending on whether your operating systems is 32 bit or 64 bit.

04. Inside the Windows directory.

05. In one of the directories listed in the PATH environmental variable.

If you choose option 01 or 02, every time you start a new project those .dlls need to be copied to the respective folders. If you choose option 03 or 04, certain antivirus programs would find it as a threat. Hence, we will choose the last option.

In order to do that create a custom folder where you would keep all your dlls that you manually want to add. I have created “C:\ProgramFilesXXX\CustomDlls” for this purpose. Copy the QGLViewerd2.dll andQGLViewerd.dll into the directory.

Then add an environment variable (CUSTOM_DLL_DIR) of your choice and set its path to the folder you just created. Then add that to your PATH environment variable.

That’s it! You have successfully installed QGLViewer in your windows machine.

반응형

'development' 카테고리의 다른 글

Qt library 삭제.  (0) 2014.03.20
QT compile in windows  (0) 2014.03.19
Visual studio Property Sheet  (0) 2014.01.20
C# Interop – C#과 C API의 상호운영  (0) 2014.01.13
Visual Studio Slow Debugging  (0) 2013.09.10