Skip to content

Cannot compile in Visual Studio 2015 #31

@CurtisHx

Description

@CurtisHx

I'm trying to use FFF from within Visual Studio 2015 and VC++, and the example I tried (attached) does not want to compile. Here's the test file:


extern "C"
{
#include "driver.h"
#include "registers.h"
}
#include <stdint.h>
#include "CppUnitTest.h"
#include "fff.h"

DEFINE_FFF_GLOBALS;

FAKE_VOID_FUNC(IO_MEM_WR8, uint32_t, uint8_t);
FAKE_VALUE_FUNC(uint8_t, IO_MEM_RD8, uint32_t);

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace FFFTestProject
{		
	TEST_CLASS(UnitTest1)
	{
	public:
    TEST_METHOD_INITIALIZE(Init)
    {
      /*RESET_FAKE(IO_MEM_WR8);
      RESET_FAKE(IO_MEM_RD8);
      FFF_RESET_HISTORY();*/
    }
		
		TEST_METHOD(TestMethod1)
		{
			// TODO: Your test code here
		}

	};
}`

The FAKE_VOID_FUNC and FAKE_VALUE_FUNC macros are generating the following warning.

Warning C4003 not enough actual parameters for macro 'PP_ARG_MINUS1_N' FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12

Trying to compile generates the following errors, all stemming from the FAKE_VOID_FUNC and FAKE_VALUE_FUNC macros.

Error C2065 'IO_MEM_WR8': undeclared identifier FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C2065 'IO_MEM_WR8': undeclared identifier FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C2275 'uint32_t': illegal use of this type as an expression FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C2275 'uint32_t': illegal use of this type as an expression FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C2275 'uint8_t': illegal use of this type as an expression FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C2275 'uint8_t': illegal use of this type as an expression FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C2440 'initializing': cannot convert from 'initializer list' to 'int' FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12
Error C2440 'initializing': cannot convert from 'initializer list' to 'int' FFFTestProject c:\temp\projects\ffftestproject\ffftestproject\unittest1.cpp 12

FFFTestProject.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions