User forums > Help

wxWidgets problem: 'strlen' not declared in this scope

(1/4) > >>

lllf:
Hi!

Since I've been running into problems compiling projects using wxWidgets I just took a simple helloWorld.cpp and #included wx/wx.h

--- Code: ---#include <iostream>
#include "wx/wx.h"

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}


--- End code ---
These are the first lines of the build messages:

C:\Programme\wxWidgets-2.8.9\include\wx\wxchar.h||In function `size_t wxStrlen(const wxChar*)':
C:\Programme\wxWidgets-2.8.9\include\wx\wxchar.h|845|error: `strlen' was not declared in this scope
C:\Programme\wxWidgets-2.8.9\include\wx\wxchar.h||In function `char* wxTmemchr(const void*, int, size_t)':
C:\Programme\wxWidgets-2.8.9\include\wx\wxchar.h|1371|error: `memchr' was not declared in this scope
C:\Programme\wxWidgets-2.8.9\include\wx\wxchar.h||In function `int wxTmemcmp(const void*, const void*, size_t)':


Maybe I screwed up sth. because the first time I tried everything worked just fine.

The global wx variable is set to the appropriate path. I copied the setup.h to the <WXWIN>/include/wx (although I am not sure if this is the proper way to get it into the include path...)

Any ideas on this?

Setup:
C::B nightly Aug-23-2008 (5193),
wxWidgets 2.8.9,
MinGW3.4.5

Jenna:
Copying "setup.h" is not the right way, it contains setup definitions, that depend on the options you have used while compiling wxWidgets.
I sometimes read this "tip" on the forum and I think it is potential dangerous, even if it seems to work in the most cases.

If your project is setup correctly you don't need to copy anything.

Read http://wiki.codeblocks.org/index.php?title=WxWindowsQuickRef how to build wxWidgets and prepare C::B for the use of it, or look at the options of a wizard-created project.

lllf:
Hm, ok, I removed setup.h from .../wx/include now and included the path I initially copied it from in the (global) compiler options.

But this wasn't what caused the errors, they remain the same, even if I comment out the #include of wx/wx.h now, even if I remove anything related to wxWidgets from the project and clean it. I'll have a look at a wizard generated project now, like proposed...

...

Well, firstly setup.h is not found, I add the absolute path to the project's settings (it was there already but through the relative definition of the global wx variable which for some reason didn't work), then there arise new errors, e.g.

C:\Programme\wxWidgets-2.8.9\include\wx\buffer.h|127|error: `strdup' was not declared in this scope

which reminds me a lot of the errors I got previously.

Damn.  :?

Well, so I will recompile wxWidgets now, let's see...

lllf:
didn't work...  :(
but I have to admit that I did not really recompile it, i.e. I didn't clean before I did (I'll do this tomorrow)... actually I don't think that a wxWidgets rebuild will solve the problem since the errors all refer to the header files which should be the same with or without a compiled library, shouldn't they?
I'll keep trying and will inform you when I find out what is the problem or when I find a solution (but I'd prefer to know what I am doing wrong).

Jenna:
Looks more like a problem with your MinGW setup for me, because strlen is a standard c++-function.
Make sure your search-paths are set correctly.

As far as I know, "strlen" and "strdup" are declared in "string.h", which is in MinGW's include folder (e.g. "c:\MinGW\include").

Navigation

[0] Message Index

[#] Next page

Go to full version