解決過程中,發現少有的解決方案也是零星和不詳細的。我把總結的成果共享一下吧,希望能對後來者有所幫助。
windows下編譯的步驟
2005-7-28
一、 安裝必備軟體
1、 安裝oracle客戶端,其中會含有oci的庫檔案。
2、 安裝ms visual c++
二、 修改原始檔
1、增加介面。在occidml.hpp中增加extern "c" int __declspec(dllexport) funa(char* a); 在
occidml.cpp中將函式宣告修改為extern "c" int __declspec(dllexport) funa(char* a)
2、修改標頭檔案。在需要引入的所有類中,替換為
#ifndef occi_oracle
#define win32common
#include "occi.h"
using namespace oracle::cci;
using namespace std;
#endif
否則會出現錯誤如下:
d:\oracle\ora92\oci\include\occicontrol.h(1132) : error c2995: 'getvector' : template
function has already been defined
d:\oracle\ora92\oci\include\occicommon.h(425) : see declaration of 'getvector'
三、 設定環境變數
1、 設定include,這可以使cl.exe在命令行時執行成功
2、 設定lib,這可以使cl.exe在link時找到庫
四、 vc設定環境
1、 在tools->options->directories->include中加入%oracle_home%/oci/include和%oracle_home%/precomp/public。
2、 在tools->options->directories->library files中加入%oracle_home%/oci/lib/msvc/vc6和%oracle_home%/oci/lib/msvc 和%oracle_home%/precomp/lib/msvc
3、在project->setting->link->input中增加oci.lib,oraocci10d.lib,orasql10.lib,msvcrt.lib
4、在project->setting->link->general中選擇」ignore all default libraries」,然後修改為
/nodefaultlib:libcd
5、在project->setting->c/c++->preprocessor中增加win32common,_mt,_dll
否則,會出現resultset的getstring錯誤。
6、附編譯後日誌中的編譯選項為/nologo /mtd /w3 /gm /gx /zi /od /d "win32" /d "_debug" /d
"_windows" /d "_mbcs" /d "_usrdll" /d "yielddll_exports" /d "win32common" /d "_mt" /d "_dll" /fr"debug/" /fp"debug/yielddll.pch" /yx /fo"debug/" /fd"debug/" /fd
/gz /c
五、設定oracle的lisener
找到lisener.ora,修改為(envs="extproc_dlls=any")
六、部署
拷貝到oracle的bin目錄下,執行create library命令
VC介面解決方案
vc介面解決方案 關鍵字 vc 簡介 vc採用delphi裡邊成熟的介面元件vclskin,vclskin有原始碼,有一百多個,將它做成dll來用,效果相當不錯。二 效果預覽 例項中的效果如下圖 效果預覽 三 呼叫方法 建立vc工程skintest,vc的建立就不具體介紹了,新增 如下 宣告 hmo...
交叉編譯完全解決方案
注 本文僅適用於嵌入式linux系統 背景 嵌入式系統開發的頭疼問題之一就是交叉編譯。什麼是交叉編譯?簡單的說,就是程式的目標執行平台與編譯這個程式所在的平台不一樣,這樣的編譯方法就是交叉編譯。在交叉編譯乙個軟體包的時候,要適當的配置build,host和target引數。什麼是build,host...
編譯make的出錯提示解決方案
編譯出錯筆記 start.s 20 error no such instruction ldr r0,wtcon 錯誤 沒有這樣的指令 解決 編譯檔案字尾名必須為大寫s,改為start.s start.s 34 error bad instruction ldr,r0,0x4c000004 錯誤 壞...