Eclipse给我无效的参数'候选者是:void * memset(void *,int,?)'虽然我知道args很好 [英] Eclipse giving me Invalid arguments ' Candidates are: void * memset(void *, int, ?) ' though I know the args are good

查看:1045
本文介绍了Eclipse给我无效的参数'候选者是:void * memset(void *,int,?)'虽然我知道args很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在日食中收到无效的参数错误,尽管我相信我的观点是好的。建议的参数包含一个'?',我认为可能会指出问题,尽管我不知道如何解决它。



我尽力复制我在这里看到的例子:

http://www.cplusplus.com/reference/clibrary/cstring/memset/



为了确定我得到的参数是正确的。

  #include< stdio.h> 
#include< string.h>
void foo()
{
char str [] =为什么哦,为什么我的IDE会给我错误,当我知道我的参数是好的?
memset(str,' - ',4);
puts(str);
}

Eclipse在memset行中给出以下错误:



无效参数的候选人是:void * memset(void *,int,?)'



可能是什么原因?那么这个?作为第三个参考呢?



提前感谢!



PS:只是注意到当我尝试使用像malloc,calloc等操作时,我遇到类似的错误。

解决方案

在Eclipse中: p>


  • 右键单击项目

  • 单击属性

  • 展开<通过点击箭头(只需单击该项目本身就不会展开子选项),左侧的树视图中的项目 C / C ++通用从子选项中选择预处理器包含路径,宏等

  • 点击 strong>提供者选项卡

  • 选中旁边的框> CDT GCC内置编译器设置[共享]



编辑:



是有一堆默认包含并定义编译器默认添加后面当你编译的场景。这些指令可以获取eclipse来获取这些默认的预处理指令,以便它自己的索引器使用相同的设置


I am getting an invalid arguments error in eclipse, though I am confident my arguments are good. The suggested arguments contains a '?' which I think may indicate the problem, though I do not know how to fix it.

I have done my best to copy the example I saw here:
http://www.cplusplus.com/reference/clibrary/cstring/memset/

In order to be certain that I am getting the args right.

#include <stdio.h>
#include <string.h>
void foo()
{
    char str[] = "why oh why does my IDE give me errors when I know my args are good?";
    memset(str, '-', 4);
    puts(str);
}

Eclipse gives me the following error on the memset line:

Invalid arguments ' Candidates are: void * memset(void *, int, ?) '

What could be causing this? And what is up with that '?' as the 3rd arg?

Thanks in advance!

PS: Just noticed I am getting similar errors when I try to use operations like malloc, calloc, etc.

解决方案

In Eclipse:

  • right click the project
  • click properties
  • Expand "C/C++ general" the item in the left hand tree view by clicking the arrow, (just clicking the item itself does not expand the suboptions)
  • From the suboptions select "Preprocessor Include Paths, Macros etc."
  • Click the "Providers" tab
  • Check the box next to "CDT GCC Built-in Compiler Settings [ Shared ]".

Edit:

The reason this works is that there are a bunch of default includes and defines that the compiler silently adds behind the scene when you compile. These instructions get eclipse to grab these otherwise silent preprocessor directives so that it's own indexer is using the same settings

这篇关于Eclipse给我无效的参数'候选者是:void * memset(void *,int,?)'虽然我知道args很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆