Hookfunction() error : missing type specifier

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
alt + 255
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 02, 2018 9:12 pm

Hookfunction() error : missing type specifier

Post by alt + 255 »

Hi,
I recently build wxwidgets from sources with MSVC 2017, but when I use it in a program, it ends by:

Code: Select all

error C4430: missing type specifier - int assumed. note c++ does not support default-int
This error is caused by the file "(wxWidgets)/include/wx/msw/msgdlg.h", on the line 43 :

Code: Select all

static WXLRESULT wxCALLBACK HookFunction(int code, WXWPARAM, WXLPARAM);
I have included the folders "(wxWidgets)/lib/vc_lib/mswu" and "(wxWidgets)/include", my lib folder is "(wxWidgets)/lib" and my resources folder is "(wxWidgets)/include"
I have linked all the files in the "(wxWidgets)/lib/vc_lib" folder, but it still does this error

Am I doing something wrong? Or should I rebuild wxWidgets with other options (I don't remember which I used)?
Thanks for any help

(and sorry for the eventual mistakes, I'm not english so...)
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Hookfunction() error : missing type specifier

Post by doublemax »

Just to be clear:

Building the wxWidgets libraries works fine, you only get the error when you build your own project?
Did your project work with an older version of either wxWidgets or Visual Studio?

Which exact wxWidgets version did you get?

Can you build the "minimal" sample that comes with wxWidgets?
If yes, my guess would be either wrong preprocessor flags in your project or a wrong order of include files.
Use the source, Luke!
alt + 255
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 02, 2018 9:12 pm

Re: Hookfunction() error : missing type specifier

Post by alt + 255 »

I have built the wxWidgets 3.0.3 library with the visual studio project ((wxWidgets)/build/msw/wx_vc12.sln) and there are no errors, it has ended by something like "x project build, 0 failure, 0 ignored".

I also tried to build the minimal sample, and the project "geometry" in the "tests" folder, and I still have the error of the hookfunction (and the geometry project also told me that the folder "cppunit" doesn't exist, which is true)

Ho and I don't know if it has an importance, but I use the visual studio compiler with the code::blocks IDE
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Hookfunction() error : missing type specifier

Post by doublemax »

I also tried to build the minimal sample...
Did you build it inside VS through the project file? If yes, that would be strange. In that case i would suggest to try wxWidgets 3.1.1, maybe VS2017 is too new for 3.0.3
and the project "geometry" in the "tests" folder
These are unit tests, ignore them for now.
Use the source, Luke!
alt + 255
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 02, 2018 9:12 pm

Re: Hookfunction() error : missing type specifier

Post by alt + 255 »

I have built it with the visual studio project file and with code::blocks, both hasn't worked (the famous hookfunction)
I will try to build wxWidgets 3.1.1, maybe it will change something
alt + 255
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 02, 2018 9:12 pm

Re: Hookfunction() error : missing type specifier

Post by alt + 255 »

I have tried with the version 3.1.1 and it does the same error, so I have modified the msgdlg.h file (with \ everywhere on the line 43), and I think that the problem is that my compiler don't recognize wxCALLBACK and WXLPARAM and try to replace them with int, but I dont' know why
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Hookfunction() error : missing type specifier

Post by doublemax »

Which configuration did you use when building wxWidgets? If you can't remember, just build it again ( do a "clean" + "rebuild", not just "rebuild").
Use the source, Luke!
alt + 255
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 02, 2018 9:12 pm

Re: Hookfunction() error : missing type specifier

Post by alt + 255 »

I have built the unicode static release version of the library, and not used monolithic
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 550
Joined: Fri Nov 03, 2006 2:00 pm

Re: Hookfunction() error : missing type specifier

Post by stahta01 »

cppunit is a unit testing framework used in wxWidgets 3.0 and before required to run wxWidget test code.
Did you install cppunit?

https://en.wikipedia.org/wiki/CppUnit

Tim S.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Hookfunction() error : missing type specifier

Post by doublemax »

alt + 255 wrote:I have built the unicode static release version of the library, and not used monolithic
That's the same i use. As i also have a system that uses VS2017, but don't see that error, I'm afraid i'm out of ideas.
Use the source, Luke!
Post Reply