- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我是 CUnit 的新手,我正在尝试运行示例代码来测试 CUnit 是否正常工作。我有三个文件。
最大高度
#ifndef MAX_H_
#define MAX_H_
extern int maxi(int, int);
#endif /* MAX_H_ */
最大.c
#include "max.h"
int maxi (int i1, int i2)
{
return (i1 > i2) ? i1 : i2;
}
和Test_max.c
#include <stdio.h>
#include <CUnit/CUnit.h>
#include <CUnit/Basic.h>
#include "max.h"
int init_suite(void)
{
return 0;
}
int clean_suite(void)
{
return 0;
}
void testMax(void)
{
CU_ASSERT(maxi(1,2) == 2);
CU_ASSERT(maxi(3,2) == 3);
CU_ASSERT(maxi(2,4) == 4);
}
int main()
{
CU_pSuite pSuite = NULL;
if (CUE_SUCCESS != CU_inizialize_registry())
return CU_get_error();
pSuite = CU_add_suite("Suite di prova", init_suite, clean_suite);
if (NULL == pSuite)
{
CU_cleanup_registry();
return CU_get_error();
}
if (NULL == CU_add_test(pSuite, "Test max", testMax))
{
CU_cleanup_registry();
return CU_get_error();
}
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
CU_cleanup_registry();
return CU_get_error();
}
当我构建时,我收到警告和错误:
- (warning) warning: implicit declaration of function 'CU_inizialize_registry' is invalid in C99 [-Wimplicit-function-declaration] if (CUE_SUCCESS != CU_inizialize_registry())
- (error) ld: symbol(s) not found for architecture x86_64
CU_inizialize_registry
有什么问题?我不明白。你可以帮帮我吗?谢谢
更多信息:MacOS 10.12.3、Eclipse、cunit 2.1-3
最佳答案
CU_initialize_registry
而不是 CU_iniZialize_registry
(t 而不是 z)呢?
关于C单元错误 : implicit declaration of function 'CU_inizialize_registry' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42432864/
我有一个模板类 展览.h: template class ExpOf{ ... } 我在整个代码中反复使用,例如T = double [和其他类ExpOf应该一无所知]。 所以我认为一次性编译它是个
如果你有一个名为“Rock”的类,你会做类似的事情:- int main() { Rock; } 为什么会出现“声明未声明任何内容”错误? 它不应该只是调用默认构造函数并在那一刻创建对象吗?
这是一个非常业余的问题,我确信这将是一个非常简单的答案,但我似乎无法弄清楚问题所在。我有一个带有相应 .cpp 文件的头文件,但出于某种原因,每当我尝试使用 g++ 进行编译时,我都会收到错误消息:
我正在使用 MinGW 将我的 Linux 项目转换为在 Windows 上编译。它在 Linux 上编译和运行都很好,但是当我尝试用 MinGW 编译它时,它会出现以下错误消息: camera.h:
我收到“decleration does not declare anything [-fpermissive] 错误”;这是我的代码; #ifndef CAMERA_H #define CAMERA
我正在编写一些 cython 代码,但遇到了一个奇怪的问题。当我尝试将对象作为结构直接从 python 传递到 C 时,cython 生成的代码很好,但 gcc 不喜欢代码输出并给我以下错误:erro
typedef struct BO2Offsets { struct Prestige { u32 offset = 0x000000; char da
我不明白 C++ 中的某些东西,gcc 不喜欢我如何进行。 我做到了: if (!fModeMdi) MyFirstClass* main = (MyFirstClas
在 switch-case 语句中,declaration-with-initialization 是无效的,但允许 declaration-and-then-assignment。如以下代码片段所示
我在我的界面文件中收到一条奇怪的警告。 这也出现在我为此声明属性的那一行。 谁能帮帮我? 最佳答案 在您的项目中的某处,您有一个 #define 将 xOffset 定义为空(除了注释)。像这样: #
declare +x 下面做了什么? (特定于 Bash。)我理解 declare -x,但不理解 declare +x: function the_func { declare +x MY_VA
由于我是 Symfony 的新手,我尝试使用 Doctrine 创建实体关系。我收到错误 “[bundle/entity/file_location”中的属性“report”已经声明,但在我尝试更新架
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 2年前关闭。 Imp
这是给我错误的代码: TAdvSmoothDockItems = class(TCollection) private FOwner: TAdvSmoothDock; FOnChange: T
我对 python 很陌生,我尝试制作一个简单的 GUI 程序。但是,我遇到了一个“问题”,确切地说是一个警告,上面写着:“m”未在全局范围内定义(Python(变量未定义全局))。 我知道如果你想在
当我用 GCC 编译程序时,它会显示“警告:声明未声明任何内容 [-fpermissive]”。 有问题的代码如下: typedef int BOOL; 如何清除警告? 最佳答案 您可以尝试以下操作。
我正在编写一个包含键值对集合的重要类,在编译期间我收到一个我无法弄清楚的非常奇怪的错误。在一个与这里的函数非常相似的函数中,但由于所需代码的复杂性而没有上下文,我收到错误: TValue& opera
这个问题很简单。为了进一步阐明,下面代码中的 Foo1 和 Foo2 在它们的声明方式方面到底有什么区别(例如,使用 class Foo1 { 。 .. }; 而另一个使用 typedef class
我正在开发 Web 项目,并且在从 Oracle 数据库迁移到 mysql 数据库时遇到一些问题。我想用这段代码创建函数: DROP FUNCTION IF EXISTS F_MANIFEST_GAB
是否有一个标志可以传递给 gcc 以禁用此警告?我知道它的作用,但这对我的程序来说无关紧要。 编辑:我只想禁用警告,保持代码不变。编译以下代码会生成警告: struct post{ unsigne
我是一名优秀的程序员,十分优秀!