2023-12-11 08:44 PM - last edited on 2024-09-17 01:07 PM by Doreena Deng
I have a plugin that compiles and works fine in AC26. I am upgrading it to AC27. I have installed the AC27 API kit and changed all references in the project file to the 27.3001 folder.
I now get about 6000 errors, many of them like these:
Code:
CParameter* Factory(const API_AddParType ¶meter);
Errors:
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int
Error C2143 syntax error: missing ',' before '&'
The Visual Studio IDE is able to identify the type API_AddParType and can navigate to the .h file if I press F12 on the type, but the compiler doesn't seem to be able to find it. (See attached image)
Could someone help with what I need to change to resolve this issue?
Solved! Go to Solution.
2024-06-27 07:44 AM
Hello,
where do you put it exactly? Right before the first reference like this:
#ifndef _PARAMETERCOLLECTION_HPP_
#define _PARAMETERCOLLECTION_HPP_
#include "Definitions.hpp"
#include <vector>
#include "WString.hpp"
#include <Parameter.hpp>
using namespace std;
class CParameterCollection
{
protected:
vector<CParameter*> m_collection;
protected:
void ClearCollection();
void CopyCollection(const CParameterCollection &src);
// added line
struct API_AddParType;
CParameter* Factory(const API_AddParType ¶meter);
or before the class like this?
#ifndef _PARAMETERCOLLECTION_HPP_
#define _PARAMETERCOLLECTION_HPP_
#include "Definitions.hpp"
#include <vector>
#include "WString.hpp"
#include <Parameter.hpp>
using namespace std;
// added line
struct API_AddParType;
class CParameterCollection
{
protected:
vector<CParameter*> m_collection;
protected:
void ClearCollection();
void CopyCollection(const CParameterCollection &src);
CParameter* Factory(const API_AddParType ¶meter);
2024-06-27 08:15 AM - last edited on 2024-06-27 11:05 AM by Laszlo Nagy
Hi,
Another idea:
#include <vector>
#ifndef ACExtension
#define ACExtension
#endif
#include "APIdefs_LibraryParts.h"
#include "WString.hpp"
Best, Akos
2024-07-02 09:57 PM - edited 2024-07-02 10:33 PM
Hi Mihaley,
I had put it before the class. When I put it directly before the reference, it gets rid of one compiler error, but then throws this error:
Error C2027 use of undefined type 'CParameterCollection::API_AddParType'
Thanks and regards,
Nick
2024-07-02 09:58 PM
Hi Akos,
Yes, that seems to get rid of about 20 of the remaining 2000 compiler errors.
Thanks and regards,
Nick
2024-07-02 10:52 PM
Another idea: it seems that the DevKit also has a file named "Parameter.hpp" (Support/Modules/GSModelDevLib/Parameter.hpp). I can imagine that somehow the AC27 build finds the one in the DevKit before the one in your library. Please try to rename your file to e.g. "CParameter.hpp" and check if that solves the problem.
If this doesn't help, please provide the full build log. When you have so many errors sometimes the real reason is hidden somewhere in the log.
2024-07-02 11:29 PM
2024-07-02 11:58 PM - edited 2024-07-03 12:10 AM
Most of the errors seemingly are coming from changes in the API interface between AC26 and AC27. There are - at least - two parts of the story.
API_AttributeIndex has been changed from a number to a class.
// AC26
typedef Int32 GSIndex;
typedef GSIndex API_AttributeIndex;
// AC27
class API_AttributeIndex
{
// ...
}
From the log it seems that you are using API_AttributeIndex as a number at several places, like in an std::map that requires a comparison operator that the new class doesn't have.
std::map<API_AttributeIndex, int> m;
Probably it will mean a bigger rewrite for you to use the class everywhere. For now you can get the index from the class, but I highly recommend using the class for future compatibility.
Several functions has been renamed in AC27. For example ACAPI_LibPart_Get is called ACAPI_LibraryPart_Get in AC27.
You have two options:
Example for such migration header:
#ifndef ServerMainVers_2700
#define ACAPI_LibraryPart_GetNum ACAPI_LibPart_GetNum
#define ACAPI_LibraryPart_Search ACAPI_LibPart_Search
#define ACAPI_LibraryPart_Create ACAPI_LibPart_Create
// ...
#endif
Since there were many changes between the two versions, prepare for a bigger task to rewrite everything. In case of renames it's "only" a manual task, in case of attribute index handling you need to figure out what will work the best for you.
2024-07-03 09:36 PM
Hi Viktor,
Thanks for that. Is there a list of function name changes? I have looked at https://graphisoft.github.io/archicad-api-devkit/md__common_doxygen_files_2_articles_2_new_01_a_p_i_... but it just says that many names have changed.
Regards,
Nick
2024-07-03 09:44 PM
Hi Nick,
You can check the file Support/Inc/ACAPI_MigrationHeader.hpp in the AC27 SDK for a list of (I think) all function name changes.
Unfortunately I wasn't able to use the file directly without modifications.
I think I've used following modifications to use it:
Hope that helps!
2024-07-09 12:37 AM
Hi Bernd, Akos, and Viktor,
I have made the changes suggested by Akos for the renamed functions and new class. I am still getting the original many errors where the compiler cannot find definitions , when the IDE can.
Bernd, I have taken your original suggestion of creating a small project that demonstrates the problem; the whole plugin is quite small, so I have attached it. Please could you try opening and compiling it?
Thanks and regards,
Nick