dereferencing pointer to incomplete type

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Thinking back to January 2007 when the first edition of this book hit the shelves, feels like time travel to the Middle Ages. The idea of using a programming language other than Java on the Java platform was widely considered frivolous. Today, a new language seems to pop up every other week, and we even go as far as designing languages for specific domains (DSLs) on a per-project basis. This evolution of languages reflects a change in concerns. If performance were still our utmost concern, we would all be coding in a low-level language. But if performance is considered “good enough” for our purposes, we now turn our focus on human approachability. Groovy has been a trendsetter for this development. Many Groovy features that ease the burden of developers are now commonplace in novel languages and may even find their way into newer versions of Java: literal declarations for common datatypes, simplified property access, null-safe dereferencing, closures, and more. Surprisingly many languages have adopted Groovy’s optional typing strategy—few languages can claim to have static and dynamic behavior at the same time, though, the way Groovy has since version 2. Just like Groovy, the first edition of this book set some trends as well. The idea of having every single listing as a self-testing piece of code resonated in the market and may be one reason why the book is among Manning’s top-ten bestsellers of the decade. Licensed to Mark Watson <nordickan@gmail.com> The feedback for the first edition was overwhelming. We never expected to have so many great developers speaking so nicely about our work. We have no words to express this feeling of being proud and humbled at the same time. Most touching, though, was the stranger who once gave Dierk a pat on the back and mumbled, “Thank you for the book!” and then disappeared into the crowd. This book is for him. We are fully aware that the first edition would have never been so successful if Groovy itself had been less appealing. The reason for Groovy’s success is easy to see: it delivers its power in the most Java-friendly manner. It is Java’s dynamic friend. The development of Groovy, from version 1.0 covered in the first edition of this book until the current version 2.4, has closed what used to be a syntax gap by providing enums, annotations, generics, the classic for loop, nested classes, varargs, static imports, and the ability to use Groovy closures where Java 8 expects lambda expressions. The Groovy project has progressed at a very high speed, not only in its core but also at its periphery. We see, for example, new usages of compile-time metaprogramming. This core feature gets instantly applied in the Spock testing framework, which in turn contributes back its “power assert” feature to the core. The community is buzzing and it has become a challenge to keep up to date with all the developments and activities. It’s only natural that many readers of the first edition of Groovy in Action (or “Gina” as we say for short) demanded an update that we are now happy to deliver as the second edition (codename “ReGina”). Our goal in this book is not only to rework the code examples, update the API description, and explain new features, but also to reflect the marketplace and the growth of the ecosystem. Groovy has evolved from a niche language to the default choice for dynamic programming on the Java platform for millions of developers. Major financial organizations use Groovy to transfer billions of dollars every day, space agencies watch the stars with the help of Groovy, and satellite live-data streams are handled by Groovy code. Groovy is traveling the oceans, shipping containers around the globe, helping software developers automate recurring tasks, and running Mom’s website. We felt an obligation to provide an up-to-date, solid, and comprehensive book to all these users. Not only did Groovy and its environment change, we authors changed as well. We enjoyed the luxury of working on Groovy projects, introducing new team members to the language, running workshops and tutorials, recognizing struggles (and occasionally struggling ourselves), finding lots of unanticipated use cases while consulting, exploring new practices, using the toolset in anger, and generally facing the Groovy development reality. The book reflects these experiences. In this second edition, we put more emphasis on the optional typing system, explain both dynamic and static metaprogramming in full depth, dive into type checking and static compilation, cover domain-specific languages, and introduce new modules that have evolved for user interfaces, testing, XML, JSON, database programing, Licensed to Mark Watson <nordickan@gmail.com> Web Services, dependency management, build automation, and concurrent programming as well as give you an updated overview of the Groovy ecosystem. We hope you will find this updated book an enjoyable and rewarding read.
### 回答1: 这个错误是因为你在尝试访问一个不完整的类型的指针。这通常是因为你没有包含所需的头文件或者你的代码中存在语法错误。你需要检查你的代码并确保你已经包含了所有必要的头文件。如果问题仍然存在,你可能需要进一步检查你的代码并查找其他错误。 ### 回答2: “error: dereferencing pointer to incomplete type”是c或c++语言中的错误信息,表示尝试使用一个未定义的结构体或类中的指针。这个报错信息通常在编译时或运行时出现,出现这个错误往往是因为程序中使用了未定义的结构体或类的指针,导致编译器无法正确识别和分配内存,从而产生了错误。 具体地说,当我们在程序中定义一个指针变量时,需要先确定该指针变量指向的类型(也就是要确定该指针指向的数据类型所在的结构体或类),如果定义该指针的类型时遇到了未定义的类型,则在使用此指针时就会出现“dereferencing pointer to incomplete type”这个错误。这个错误通常出现在定义结构体或类时没有将其完全定义或没有完整包含其定义所需的头文件时。 要解决这个错误,我们需要检查程序中所有的结构体或类定义,并确认它们是否被正确地定义。如果定义不完整,则需要包含相应的头文件进行完整定义。此外,还需要检查程序中使用指针的地方,确认是否指向了正确的数据类型,避免在使用该指针时出现错误。 总之,“error: dereferencing pointer to incomplete type”这个错误是由于程序中存在未定义的结构体或类导致的,我们需要确保所有的数据类型都被完整地定义,并在程序中正确使用指针,才能避免这个错误的发生。 ### 回答3: 这个错误信息是由C或C++编译器在编译程序时给出的。它意味着在某个地方,你试图访问一个不完整的数据类型的指针。此处,“不完整的数据类型”指的是一个数据类型的定义仍然没有被完全地指定。通常情况下,这种数据类型是被声明但未被定义的。有时,这也可能是由于错误的结构体、枚举或联合声明导致。 出现这个错误的最常见的原因之一是由于我们在程序中使用了某个库,但是该库的头文件引用没有正确包含。因此,对于编译器来说,它无法阅读关于这个数据类型完整定义。另一种原因是可能我们使用了未定义的结构体,枚举,或者类似的标识符。如果我们在使用这些标识符之前没有进行定义,系统在编译的过程中就会报出错误。还有一种很常见的原因是可能我们引用了一个为`NULL`的指针。在这种情况下,指针没有任何定义,它指向的地址空间是无效的。 要解决这种错误信息,我们需要先仔细检查我们程序的头文件和我们使用的库。如果我们的头文件引用不正确,我们需要重新引用他们,以确保我们关于该数据类型的完整定义都是正确的。我们也应该查找我们程序中所有的结构体,枚举,和其他的标识符,以确保它们的定义出现在我们使用之前。最后,我们需要检查我们使用的指针是否有很明确的定义和初始化,并且我们不会对这个指针使用空引用。在遵循这些最佳实践后,我们应该能够解决error: dereferencing pointer to incomplete type的问题,使得我们的程序顺利编译和运行。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值