1. 程式人生 > >VS2012配置Opengl以及“無法解析的外部符號

VS2012配置Opengl以及“無法解析的外部符號 阿新 發佈:2019-01-16

1、配置步驟
(1)首先下載glut相關檔案,下載地址:
http://download.csdn.net/detail/u013383042/9329101
(2)glut.h:標頭檔案,將其複製到 D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\gl
(原本沒有gl資料夾,需要手動新建一個gl資料夾)
(3)glut.lib,glut32.lib:靜態連結庫,將其複製到 D:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib
(4)glut.dll,glut32.dll:動態連結庫,將其複製到 C:\Windows\System32,電腦系統是64位的,還需將其複製到C:\Windows\SysWOW64。

至此環境配置完成。

2、可以嘗試第一個小程式了

#include <gl\glut.h>

void myDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
    glFlush();
}

int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
    glutInitWindowPosition(100
, 100)
; glutInitWindowSize(400, 400); glutCreateWindow("第一個OpenGL程式"); glutDisplayFunc(&myDisplay); glutMainLoop(); return 0; }

3、遇到的問題
(1)error LNK2019: 無法解析的外部符號 [email protected],該符號在函式 [email protected] 中被引用
(2)error LNK2019: 無法解析的外部符號 [email protected],該符號在函式 [email protected]

中被引用

效果展示:
這裡寫圖片描述
4、解決方法

#include <GL/glut.h>前面加上了一句:  
#define GLUT_DISABLE_ATEXIT_HACK 
(!!!注意,是前面!!!)

這裡寫圖片描述

執行結果:
這裡寫圖片描述

至此,問題迎刃而解!

相關推薦

VS2012配置Opengl以及無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cc9393a5a1bc93939393aba0b9b885a2a5b89ba5b8a489b4a5

1、配置步驟 (1)首先下載glut相關檔案,下載地址: http://download.csdn.net/detail/u013383042/9329101 (2)glut.h:

無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1e41497770537f77705e2f28">[email protected]a>,該符號在函式 ___tmai

#include using namespace std; int main() { cout <<“This is a C++ program.”; return 0; } 1>------ 已啟動生成: 專案: hello1, 配置: Debug Win32 ---

[Visual Studio C++] [MFC 除錯錯誤]:error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c09f9fa9adb09f9fb4a9a

1.編譯問題描述:  error LNK2019: 無法解析的外部符號 [email protected],該符號在函式 "public: unsigned int __thiscall CMultimediatimerDlg::CreateTimer(void)" ([em

VS2015 error LNK2019 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="19464e70775478707759282f">[email protecte

前言 上一篇文章中,為了編譯OpenCV的示例程式碼,然後搭建環境, 最後想直接執行示例demo,我在建立新工程的時候,直接建立了一個win32視窗專案,然後環境配置完成後,將opencv 的示例程式碼kalman.cpp直接匯入到新建的vs工程中進行編譯,直接報錯: 錯誤 LN

error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="702f031f131b1504304142">[email protected]a>,該

Reason: 學習使用socket,在stdafx.h檔案加了#include ,編譯 #include "stdafx.h" #include   using namespace std;   int _tmain(int argc

Bug(九) —— error LNK 2019 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="58070731352807072c31353d1f3d2c0c31353d1868

錯誤顯示: error LNK 2019 無法解析的外部符號 [email protected],該符號在函式 "public: virtual void __thiscall ViewWidget::paintEvent(class QPaintEvent*)"

【C++】error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a6f9f1cfc8ebc7cfc8e69790">[email protected

原因:c語言執行時找不到適當的程式入口函式 解決:對於控制檯應用程式 1.選單中選擇 Project->Properties, 彈出Property Pages視窗 2.在左邊欄中依次選擇:Configuration Properties->C/C++->

MSVCRTD.lib(crtexew.obj) : error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e1beb6888fac80888fa1d0d7"

一,問題描述 MSVCRTD.lib(crtexew.obj) : error LNK2019: 無法解析的外部符號 [email protected],該符號在函式 ___tmainCRTStartup 中被引用 Debug\jk.exe : fa

[Visual Studio C++] [MFC 除錯錯誤]:error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ed1d1e7e3fed1d1fae7e

1.編譯問題描述:錯誤    3    error LNK2019: 無法解析的外部符號 [email protected],該符號在函式 "public: unsigned int __thiscall CMultimediatimerDlg::CreateTim

【轉】MSVCRTD.lib(crtexew.obj) : error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="adf2fac4c3e0ccc4c3ed9c

@2018-12-18 【小記】 vs-2013 編譯 cJSON code in git-hub 時遇見問題 error LNK2019,解決如下 【問題描述】MSVCRTD.lib(crtexew.obj) : error LNK2019: 無法解析的外部符號 [email pr

Visual Studio 2013 C++ 呼叫mysql錯誤 error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9dc2f0e4eeecf1c2f4f

因為我的系統是64位的,當時安裝的mysql也是64位的,但是我用visual sutido 2013建立的專案預設是32位的,所以導致該錯誤出現,解決方法最好就是改用32位的mysql,也可以將專案編譯為64位,步驟如下: 1 需要專案屬性---->配置屬性

windows程式設計原始碼:無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0956566064795656596568705a667c676d5e49383b">[email&#

     作者:mickole 出處:http://www.cnblogs.com/mickole/   windows程式設計原始碼在vs2015上執行出現: 無法解析的外部符號 [email protected] 1>HelloWi

error LNK2019 : 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aff0f0c6c2dff0f0f0f0c8c3dadbe6c1c6dbf8c6dbc7ead7c6d

本來嘗試使用VS2017的,奈何c++在17中貌似改變了很多,不方便和之前的庫一起使用,只好暫時放棄;轉而使用VS2013… … 下載安裝配置freeglut3.0很順利,畢竟已經被坑過很多次了;在編譯的時候遇到了如下如題問題: 切換成windo

編譯caffe 遇到error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="633c3c0a0e133c3c3302170b2e0217000b30130600

這是在gflags中的,由於google為了相容windows xp之前的系統 在config.h中有 // Define if you have the <shlwapi.h> h

[轉]在vs2008上編譯獲取cpu程式碼出現的錯誤- error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="91ced6f4e5c1e3fef2f4e2e2

1>正在連結...1>LINK : 沒有找到 E:\yy\20110112\cpuproject\cpu\Debug\cpu.exe 或上一個增量連結沒有生成它;正在執行完全連結1>cpu.obj : error LNK2019: 無法解析的外部符號 ,該符號在函式 "void __cde

[轉]MSVCRTD.lib(crtexew.obj) : error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ed1d9e7e0c3efe7e0cebf

二,原因及解決辦法 產生這個問題的真正原因是c語言執行時找不到適當的程式入口函式,一般情況下,如果是windows程式,那麼WinMain是入口函式,表示工程中可以建立圖形視窗。 如果是dos控制檯程式,那麼main是入口函式,在VS2010中新建專案為“w

error lnk2001無法解析外部符號_main 無法解析外部符號<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="de8189b7b093bfb7b09eefe8">[email 

這個問題表明你新建的是一個main型別函式(控制檯程式),而你的程式中有視窗程式,顯然是個win32函式,解決方法:專案-屬性-連結器-系統-子系統-把控制檯該為windows剛學WinAPI編譯遇到不少問題,LNK2019: 無法解析的外部符號 _main,該符號在函式 ___tmainCRTStartup

MSVCRTD.lib(crtexew.obj) : error LNK2019: 無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e3bcb48a8dae828a8da3d2d5"

一,問題描述 MSVCRTD.lib(crtexew.obj) : error LNK2019: 無法解析的外部符號 [email protected],該符號在函式 ___tmainCRTStartup 中被引用 Debug\jk.exe : fatal er

無法解析外部符號 <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c29da1b7a0aea3b1a1b0a7a3b6a79db4f082f6">[email protected]a>,

首先貼出我的問題,解決的就是這個問題。要解決這個問題,首先要看你的cuda環境配置的是否正確,那麼就要從頭跟著我們走一遍,再檢查一下您配置的是否正確。1>1.cu.obj : error LNK2019: 無法解析的外部符號 cublasDestroy_v2,該符號在函