Cause
This error can occur in build stubs for template functions when the template argument is an incomplete type. This happens if the template argument is a struct or class that has been declared but not defined.
Solution
If the incomplete type is not implemented in the source code, you should implement the class. Alternatively, you can include the file that contains the definition of the class to resolve the incomplete type issue. If modifying the source code is not an option, you can write the definition code for the incomplete type in the stub code. Below is an example of adding the definition code for the incomplete type in the stub code.
Example
Here is an example of the source code and the stub code.
// Source code
template < int, typename B >
class mMap {
public:
mMap() {
B b;
}
};
class Incomplete; // Forward-declared class
class mdLoadedConfig
{
public:
mdLoadedConfig();
private:
mMap<0x8100, Incomplete > m_mapConfigHDMapInfo;
};
int test(mdLoadedConfig a) {
return 0;
}
// Stub code
class Incomplete {}; incomplete type error
mdLoadedConfig::mdLoadedConfig()
{
/// Stub body start
/// Stub body end
}
CT 2024.12 provides a placeholder for incomplete types in build stubs where incomplete type errors may occur and adds incomplete type error
to the code. This generates a compilation error at the location where implementation is needed, providing a guide for the user to make the necessary modifications.
By checking the Error View, you can see that the error occurs at the incomplete type error
location.
Delete the incomplete type error
from the stub code and write an appropriate definition for the incomplete type class Incomplete
. If necessary, add member variables and member functions to the definition. In this example, an empty definition is written without adding member variables or functions. When you rerun the test or use compile test, you will see that the stub error has been resolved.
Need more help with this?
Don’t hesitate to contact us here.