Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. odd error message in Creator editor
Forum Updated to NodeBB v4.3 + New Features

odd error message in Creator editor

Scheduled Pinned Locked Moved Solved The Lounge
4 Posts 2 Posters 1.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    Hi all -

    This isn't a Qt problem per se, so I'm not asking about it in the usual forum.

    I'm using Creator as an editor and code browser (but not building or debugging) for an embedded project. My use of the std::string type is giving me an odd error:

    void test()
    {
        std::string s;
        s.clear();
    }
    

    produces "error: member reference base type 'std::string' (aka 'int') is not a structure or union"

    When I compile the code under MSYS2, it's OK, so this is just an annoyance, but I'd be curious as to how to eliminate this error message. My online searches didn't reveal anything helpful.

    Thanks...

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      This pretty much means that the std::string type is unknown. Maybe you're just missing an include for strings in that file? Things like this often go unnoticed as string can easily get pulled from transitive includes or global settings in a large project. Since you're using Creator only for editing it probably doesn't have knowledge of entire project dependencies.

      If you're using clang code model you can click on Tools->C++->Inspect C++ Code Model and check the Header Paths tab to see what it sees.

      1 Reply Last reply
      7
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        Hi Chris - yeah, that was it...the include file naming in the ESP32 library is a bit unconventional, I guess. I'd been using <string.h> instead, and it worked, but <string> now also works (this is a fairly young library, so they may be renaming files between releases). Thanks...

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Cool, I'm glad that it worked.
          Just to be clear,<string.h> is the C strings library (has strcpy(), memcmp() and the likes). The C++ equivalent for this is <cstring>.
          None of these have the C++ type std::string, which requires <string>, so the fact that it worked when compiling was not due to the <string.h> include. It just pulled <string> from somewhere.

          1 Reply Last reply
          5

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved