MAC下写的DLL编译出错:error: parse error before 'wxC Topic is solved

这是wxWidgets论坛的中文版本。在这里,您可以用您的母语汉语讨论上面任一子论坛所涉及的所有关于wxWidgets的话题。欢迎大家参与到对有价值的帖子的中英互译工作中来!
Post Reply
kevin_fly
Experienced Solver
Experienced Solver
Posts: 50
Joined: Tue Apr 15, 2008 12:55 am

MAC下写的DLL编译出错:error: parse error before 'wxC

Post by kevin_fly »

请高手指点下面错误是因为什么引起的?
../wx/buffer.h:96: error: parse error before "wxCharBuffer"
../wx/buffer.h:96: error: syntax error before '{' token
...
kevin_fly
Experienced Solver
Experienced Solver
Posts: 50
Joined: Tue Apr 15, 2008 12:55 am

Post by kevin_fly »

我写的DLL功能很简单,就是在一个导出函数中显示一个UI
我感觉可能与工程配置有关,但是对照sample中的例子,检查不出问题
请各位大虾给看看,先谢啦
kevin_fly
Experienced Solver
Experienced Solver
Posts: 50
Joined: Tue Apr 15, 2008 12:55 am

Post by kevin_fly »

没人回帖。。。
难道是因为汶川地震???
spritez
Earned a small fee
Earned a small fee
Posts: 21
Joined: Sat Apr 19, 2008 2:16 pm
Location: china

Post by spritez »

没用过MAC,两行错误提示并不能判断问题。要看上下文的情况。你有没有使用Unicode编码?

最好把错误行所在函数源码列出...
*** china ***
Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil »

请楼主提供更多的信息。

你是在Mac下编译xWidgets库的时候遇到这样的问题?你需要给出你做了什么,你的源代码,你的IDE,等等。就这么一丁点信息,谁都没有办法弄清楚是怎么回事。
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
kevin_fly
Experienced Solver
Experienced Solver
Posts: 50
Joined: Tue Apr 15, 2008 12:55 am

Post by kevin_fly »

code
----------------------------------------------------------
export.h

int FunTest(int a, int b);
void OpenWnd();

export.cpp

#include <wx/wx.h>
#define EXPORT __attribute__((visibility("default")))
int EXPORT FunTest(int a, int b)
{
return a+b;
}

void EXPORT OpenWnd()
{
wxFrame* pFrame = new wxFrame(...);
pFrame->Show(...);
}
-----------------------------------------------------------
if i only export the FunTest(...), i call it by another application, and it's ok, but when i export OpenWnd(), there will appere many errors.

my code is a simple sample to export a UI for other application, but when comple first line(wx/wx.h),there will apper a lot of error,and by now, the compiler can't comile my any one line code still.

How did you build and install wxWidgets?
I didn't install wxWidgets, but i download it's code and compile successfull

Do wx samples build?
yes, the sample "minimal" comiled and run OK

How did you build your project/makefile?
my project creted by xcode, it is a dynamic link library.
kevin_fly
Experienced Solver
Experienced Solver
Posts: 50
Joined: Tue Apr 15, 2008 12:55 am

Post by kevin_fly »

编译器编译到#include <wx/wx.h>就一层层的编译进去,最后到了buffer.h,就提示出错了

我感觉好像是预编译的问题,没有设置好预编译条件或者工程属性,但是对照着例子检查了好多遍,也试着修改了一些地方,都是不行。
Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil »

是wxWidgets2.8.7吗?

错误信息的其余部分?没有什么什么not declared?

你是用configure编译wxWidgets的吗?你加了什么选项?Mac OS版本?XCode版本?

你同时也发了英文的帖子吗?能给出链接吗?

我在Mac下面一般都是用Makefile的,没试过XCode的工程...

-Utensil
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
kevin_fly
Experienced Solver
Experienced Solver
Posts: 50
Joined: Tue Apr 15, 2008 12:55 am

Post by kevin_fly »

我也是第一次在MAC上写程序,项目需要
用的是XCode编程环境,没用makefile
错误提示中没有什么没定义
我的程序只是简单的导出了一个wx窗口,没做别的事情
不知道你在MAC下用wxWidgets做过动态库没?
非常感谢你的回复:-)
Utensil
Moderator
Moderator
Posts: 423
Joined: Sun Feb 03, 2008 11:38 am
Location: China

Post by Utensil »

我印象中把wxWidgets写的程序导出到Dll经常出问题,在这个论坛里我看到过不止10篇问这种问题的帖子。

一般这种问题的产生,甚至不需要你做任何事,只需要#include <wx/wx.h>就足以导致一堆问题了。

你试着在论坛里搜索一下吧~应该有帖子已经有解答的~我还没试过把wxWidgets写的程序导出到Dll~

-Utensil
In fascination of creating worlds by words, and in pursuit of words behind the world.

On Github: http://utensil.github.com
Technical Blog in Chinese: http://utensil.iteye.com/
kevin_fly
Experienced Solver
Experienced Solver
Posts: 50
Joined: Tue Apr 15, 2008 12:55 am

Post by kevin_fly »

好的,多谢你的指点和关注:-)
Post Reply