提问人:BinBenBose 提问时间:11/16/2023 更新时间:11/16/2023 访问量:36
错误;“函数定义未声明参数”[已关闭]
Error; "function definition does not declare parameters" [closed]
问:
我正在尝试编写一个简单的程序,将“Hello”消息写入SDRAM 512MB IC。可悲的是,在尝试编译这个 pogram 时,我偶然发现了这个错误;
“错误:函数定义未声明参数”
似乎说错误出在 writeToIC 命令中,因为 ths 是突出显示的。 由于我对使用 C++ 编程相对较新,有人可以告诉我错误在哪里以及如何修复它吗?
这是完整的程序;
// Including the necessary libraries for GPIO control and exception handling.
#include <iostream>
#include <stdexcept>
int gpioout = 14;
// Function to write a "Hello" message to an SDRAM FBGA-84 SDRAM IC using a digital GPIO pin.
void writeToSDRAM() {
try {
// Write the "Hello" message to the SDRAM IC.
writeToIC("Hello");
std::cout << "Message successfully written to SDRAM IC." << std::endl;
} catch (const std::exception& e) {
std::cerr << "Error: " << e.what() << std::endl;
}
}
// Unit tests for the writeToSDRAM function.
#include <gtest/gtest.h>
/**
* @namespace SDRAMTest
* This namespace encapsulates all the unit tests for the SDRAM functions.
*/
namespace SDRAMTest {
/**
* @class SDRAMWriteTest
* This class is designed to hold unit tests for the writeToSDRAM function.
* Every method in this class is a separate test scenario.
*/
class SDRAMWriteTest : public ::testing::Test {
protected:
/**
* Test to check if the "Hello" message is successfully written to the SDRAM IC.
* @input: None
* @output: No exceptions are thrown.
*/
TEST_F(SDRAMWriteTest, TestWriteToSDRAM) {
EXPECT_NO_THROW(writeToSDRAM());
}
};
}
int main() {
// Example: Writing a "Hello" message to an SDRAM FBGA-84 SDRAM IC using a digital GPIO pin.
writeToSDRAM();
return 0;
}
我一直很困惑,因为我不知道该怎么办。
答: 暂无答案
评论