C_and_CPP 板


LINE

大家好, 遇到了些問題想請教各位大大, 我在使用paper所提供的程式碼, 後來在下載他的sample code後有error, 但不知道要從什麼地方改起 這是網址,想執行上面所提供的sample code,但一直失敗 You can download the GWO library from http://sourceforge.net/projects/thegwolibrary/ sample code 來源 http://thegwolibrary.sourceforge.net/ The system requirements of the GWO library are as follows: (1) Operating system : Windows XP (2) NVIDIA CUDA version : 2.0 (please download here) (3) NVIDIA GPU (Geforce8800 higher) The installation of the GWO library is as follows: (1) Please place the GWO files (gwo.dll, gwo.h, gwo.lib) on your project directory. (2) Please register gwo.h and gwo.lib to your project. If you have any problem or want to add a new function to the library, please feel free to contact me. %%%%%%%%%%%%%%%%%% SAMPLE CODE %%%%%%%%%%%%%%%%%%%%%% Sample code using the GWO library (1) We show a sample code in order to calculate diffraction. #include "gwo.h" #define WIDTH 1024 #define HEIGHT 1024 #define WIDTH2 (WIDTH*2) #define HEIGHT2 (HEIGHT*2) float gwo_max=0.0, gwo_min=0.0; //gwoComplex is the complex number. //if you use to the real part of gwoComplex, please use GWO_RE(...). //if you use to the imaginary part of gwoComplex, please use GWO_IM(...). gwoComplex ape_small[WIDTH*WIDTH]; gwoComplex ape[WIDTH2*HEIGHT2]; gwoComplex result[WIDTH*HEIGHT]; unsigned char pix[WIDTH*WIDTH]; void main() { //Prepare an aperture with 20*20 pixel. for(int i=0;i<HEIGHT;i++) { for(int j=0;j<WIDTH;j++) { if(j>WIDTH/2-10 && j<WIDTH/2+10 && >HEIGHT/2-10 && i<HEIGHT/2+10) { GWO_RE(ape_small[(j)+(i)*WIDTH])=1.0; GWO_IM(ape_small[(j)+(i)*WIDTH])=0.0; } } } //Initialize the library. gwoInit(GWO_ANGULAR,WIDTH2,HEIGHT2); //if you calculate the Angular spectrum //gwoInit(GWO_FRESNEL_CONV,WIDTH2,HEIGHT2);//if you calculate the Fresnel difraction(convolution type) //gwoInit(GWO_SHIFTED_FRESNEL,WIDTH2,HEIGHT2);////if you calculate the Shifted-Fresnel difraction //Expands the original aperture (ape_small). //The expanded aperture (ape) has double size as compared with the original aperture. gwoHostExpandC2C( ape_small,WIDTH,HEIGHT, ape,WIDTH2,HEIGHT2); //Set the sampling spacing (4.65 um) on the aperture and the diffracted plane. gwoSetPitch(4.65e-6, 4.65e-6); //Set the wavelength (633nm). gwoSetWaveLength(633.0e-9); //Send the expanded aperture to the GPU. gwoSendData(ape); //Calculate the diffraction with the propagation distance of 0.2m. gwoCalc(0.2); //If you need the light intensity of the diffracted light, //please execute gwoIntensity(). //If you do not need the light intensity, //please comment out gwoIntensity(); gwoIntensity(); //The host computer receives the calculated result (the diffracted result). gwoReceiveResult(ape); //Reduce the expanded aperture (ape) to the buffer (result). gwoHostExpandC2C( ape,WIDTH2,HEIGHT2, result,WIDTH,HEIGHT); //Search the maximum and minimum value in the buffer (result). gwoHostSearchMaxMin(result,&gwo_max,&gwo_min,WIDTH,HEIGHT); //Convert the light intensity to 256 monochrome image. for(int i=0;i<HEIGHT;i++) { for(int j=0;j<WIDTH;j++) { float tmp=GWO_RE(result[j+i*WIDTH]); unsigned char c=(unsigned char)(255.0*(tmp-gwo_min)/gwo_max)); pix[j+i*WIDTH]=c; } } //Finalize the library. gwoFree(); } --



※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.122.193.103
1F:→ blackwindy:所以error是什麼? 11/19 08:53
2F:→ aada:fatal error C1010: 尋找先行編譯標頭檔指示詞時碰到未預期 11/19 10:15
3F:→ aada:的檔案結尾。您的原始檔中是否忘了加上 '#include "stdafx.h" 11/19 10:15
4F:→ aada:但是加了#include "stdafx.h"業還是有錯誤 11/19 10:16
5F:推 ledia:pch 的問題是一回事, 這裡用到的 gwo 似乎跟 link 下載到的 11/19 11:08
6F:→ ledia:版本不太合.... 11/19 11:08
7F:→ ledia:interface 長得不太一樣 11/19 11:08
8F:→ aada:interface不太一樣是什麼意思? 11/19 12:10
9F:→ TeaEEE:在專案的property pages中的Precompiled Header設定裡 選擇 11/19 14:12
10F:→ TeaEEE:Not Using Precompiled Headers看看 11/19 14:13
11F:→ aada:我試了,fatal error C1083: 無法開啟包含檔案: 'gwo.h': No 11/19 14:41
12F:→ aada:such file or directory 11/19 14:42
13F:→ aada:把程式照相起來 http://0rz.tw/buuOn 11/19 14:50
※ 編輯: aada 來自: 140.122.193.103 (11/19 14:52)







like.gif 您可能會有興趣的文章
icon.png[問題/行為] 貓晚上進房間會不會有憋尿問題
icon.pngRe: [閒聊] 選了錯誤的女孩成為魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一張
icon.png[心得] EMS高領長版毛衣.墨小樓MC1002
icon.png[分享] 丹龍隔熱紙GE55+33+22
icon.png[問題] 清洗洗衣機
icon.png[尋物] 窗台下的空間
icon.png[閒聊] 双極の女神1 木魔爵
icon.png[售車] 新竹 1997 march 1297cc 白色 四門
icon.png[討論] 能從照片感受到攝影者心情嗎
icon.png[狂賀] 賀賀賀賀 賀!島村卯月!總選舉NO.1
icon.png[難過] 羨慕白皮膚的女生
icon.png閱讀文章
icon.png[黑特]
icon.png[問題] SBK S1安裝於安全帽位置
icon.png[分享] 舊woo100絕版開箱!!
icon.pngRe: [無言] 關於小包衛生紙
icon.png[開箱] E5-2683V3 RX480Strix 快睿C1 簡單測試
icon.png[心得] 蒼の海賊龍 地獄 執行者16PT
icon.png[售車] 1999年Virage iO 1.8EXi
icon.png[心得] 挑戰33 LV10 獅子座pt solo
icon.png[閒聊] 手把手教你不被桶之新手主購教學
icon.png[分享] Civic Type R 量產版官方照無預警流出
icon.png[售車] Golf 4 2.0 銀色 自排
icon.png[出售] Graco提籃汽座(有底座)2000元誠可議
icon.png[問題] 請問補牙材質掉了還能再補嗎?(台中半年內
icon.png[問題] 44th 單曲 生寫竟然都給重複的啊啊!
icon.png[心得] 華南紅卡/icash 核卡
icon.png[問題] 拔牙矯正這樣正常嗎
icon.png[贈送] 老莫高業 初業 102年版
icon.png[情報] 三大行動支付 本季掀戰火
icon.png[寶寶] 博客來Amos水蠟筆5/1特價五折
icon.pngRe: [心得] 新鮮人一些面試分享
icon.png[心得] 蒼の海賊龍 地獄 麒麟25PT
icon.pngRe: [閒聊] (君の名は。雷慎入) 君名二創漫畫翻譯
icon.pngRe: [閒聊] OGN中場影片:失蹤人口局 (英文字幕)
icon.png[問題] 台灣大哥大4G訊號差
icon.png[出售] [全國]全新千尋侘草LED燈, 水草

請輸入看板名稱,例如:Tech_Job站內搜尋

TOP