1

Although finding <wx/cmdline.h>, NetBeans complains error in <wx/wxprec.h> and <wx/socket.h>

error

Build:

g++ `wx-config --cxxflags`     -o dist/Debug/GNU-Linux-x86/client build/Debug/GNU-Linux-x86/main.o -lpthread `wx-config --cxxflags`

Project Properties in NetBeans

projectProperties1

projectProperties2

I need to include these files to create a socket, I'm trying to do the following:

wxPrintf("Creating socket...\n");
wxSocketClient socketClient;
socketClient = new wxSocketBase(wxSOCKET_NONE);

wxPrintf("Addressing...\n");
wxIPV4address addr;
addr.Hostname("127.0.0.1");
addr.Service(3000);
if (!socketClient.IsOk())  {
    wxPrintf("Could not listen at the specified port !\n");
    return 1;
}

wxPrintf("Trying to make connection...\n");
if (socketClient.Connect(addr, false)) {
    wxPrintf("Success\n");
} else {
    wxPrintf("Error!\n");
    return 1;
}

My project is just console. I do not need GUI.

macabeus
  • 4,156
  • 5
  • 37
  • 66
  • What is result of `wx-config --cxxflags` execution from the command line? Does `cmdline.h` exist in `cxxflags` directories, and what about `socket.h`? Please post full build command line, error messages and relevant code instead of screenshots. – Alex F Jun 18 '14 at 13:54
  • BTW, for linker you should use `wx-config --ldflags` – Alex F Jun 18 '14 at 13:56
  • Added in the message the line of build. When I try to add `ldflags` always advises that it does not recognize. `cmdline.h` and `socket.h` are in the same directory. – macabeus Jun 18 '14 at 14:09

1 Answers1

3

Your IDE doesn't seem to recognize the backticks expansion mechanism, so you need to run wx-config --cxxflags in the terminal and then copy and paste the output into the IDE instead of using it there directly (and possibly complain to NetBeans developers and hope that they do add support for this very useful functionality in future versions).

VZ.
  • 21,740
  • 3
  • 39
  • 42
  • In the console returned `-I/usr/lib/i386-linux-gnu/wx/include/gtk2-unicode-3.0-unofficial -I/usr/include/wx-3.0-unofficial -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread`, but where exactly should I put this in the settings of NetBeans? Replace the two `wx-config --cxxflags`? – macabeus Jun 18 '14 at 14:41
  • You should have a NetBeans-generated makefile in your project directory - this is the correct place to add backtick expressions. – HEKTO Jun 19 '14 at 16:54