[AGENT++] Agent++ build problem on Windows
Zwam, van Brian
brian.van.zwam at saabgroup.com
Tue Sep 18 13:10:05 CEST 2018
Hi,
I want to report another bug we found.
When building the agent++ library on windows, the build fails.
We get the following errors:
\agent++-4.1.2\src\request.cpp(803) : error C2121: '#' : invalid character : possibly the result of a macro expansion
\agent++-4.1.2\src\request.cpp(803) : error C2065: 'ifdef' : undeclared identifier
\agent++-4.1.2\src\request.cpp(803) : error C2146: syntax error : missing ';' before identifier 'delete_lock_queue'
\agent++-4.1.2\src\request.cpp(803) : error C2065: 'endif' : undeclared identifier
\agent++-4.1.2\src\request.cpp(803) : error C2143: syntax error : missing ';' before '}'
Looking at the code we saw the following:
Starting at line 793 in request.cpp
RequestList::~RequestList() TS_SYNCHRONIZED(
{
delete requests;
if (write_community)
delete write_community;
if (read_community)
delete read_community;
#ifdef NO_FAST_MUTEXES
delete_lock_queue();
#endif
})
This functions contains a macro that can be found at Line 88 in threads.h
#define TS_SYNCHRONIZED(x) { ThreadSynchronize _ts_synchronize(*this); x }
We came to the conclusion that the MSVC compiler doesn't support Ifdefs inside a macro. We solved this by applying a patch that expands the macro in the request.cpp file.
I created a simple example:
It builds on with GCC but not with MSVC.
https://godbolt.org/z/GOlY_5
Kind regards,
Brian van Zwam
More information about the AGENTPP
mailing list