sztrace not declared ?

2009-05-19
今天用Alchemy編譯一個C++文件時,得到如下錯誤:
error: ‘sztrace’ was not declared in this scope

在c裡面sztrace函數都可以直接使用,怎麼到了c++就出錯了呢... 搜索一下在Adobe Forums裡有如下解答:
sztrace is a C, rather than C++, function.  Because your are compiling your code as C++, you must wrap your manual declaration with extern "C" { } so that the function is not given c++ decorations.

OK,在代碼裡加入如下定義,編譯成功~~
extern "C"{
    void sztrace(char*);
}

M-OSCAR | Powered by Blogger | Entries (RSS) | Comments (RSS) | Designed by MB Web Design | XML Coded By Cahayabiru.com