C odr用法案例詳解

2022-09-24 13:03:14 字數 1159 閱讀 2025

// the main module. file: odr_test1.cpp

#include

void module1_print(); // declaration of an exeternal function

inline int f1()

class a};

const double c = 4.2;

constexpr double e = 4.5;

void print()

int main()

// file: module1.cpp

#include

inline int f1()

class a};

const double c = 3.2;

constexpr double e = 3.5;

void module1_print()

clang++ module1.cpp odr_test1.cpp

執行結果:

若進行程式設計客棧下面的編nrkyr譯:

clang++ odr_test1.cpp module1.cpp

則結果如下 

g++ module1.cpp odr_test1.cpp -std=c++11

若進行如下編譯

g++ odr_test1.cpp mwww.cppcns.comodule1.cpp -std=c++11

// the main module. file: odr_test2.cpp

#include

void module2_print(); // declaration of an external function

namespace

class a};}

const double c = 4.2;

constexpr double e = 4.5;

void print()

int main()

// file: module2.cpp

#include

namespace

class a};}

const double c = 3.2;

constexpr double e = 3.5;

void module2_print()

執行結果

MFC LoadImage用法案例詳解

目錄 handle loadimage hinstance hinst,若引導程式外部資源傳null,否則一般傳afxgetinstancehandle lpctstr lpszname,名稱或全路徑 uint utype,型別 image bitmap或image icon或image curso...

C pictureBox用法案例詳解

picturebox 控制項可以顯示來自位圖 圖示或者元檔案,以及來自增強的元檔案 jpeg 或 gif 檔案的圖形。如果控制項不足以顯示整幅圖象,則裁剪圖象以適應控制項的大小。展示了控制項的sizemode四種格式 最好的應該是zoom,在不發生形變的條件下,對進行縮放。sizemode auto...

VBA陣列用法案例詳解

目錄 vba陣列在excel開發應用中,作用還是很明顯的,用好陣列可以提高工作效率,下面就開始揭開vba陣列的神秘面紗。下面是幾種陣列常用的定義方法,一維陣列的定義 二維陣列的定義 直接賦值定義 呼叫array函式定義 呼叫excel工作表記憶體陣列 直接定義給陣列賦值 一維常量陣列的定義 sub ...