CopernicaMarketingSoftware / AMQP-CPP

C++ library for asynchronous non-blocking communication with RabbitMQ
Apache License 2.0
884 stars 340 forks source link

Errors C2589 and C2059 for illegal tokens #498

Open MonicaLiu0311 opened 1 year ago

MonicaLiu0311 commented 1 year ago

Describe the bug The following error occurs when using amqpcpp:

E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(85,42): error C2589: '(': illegal token on right side of '::' 
E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(85,42): error C2059: syntax error: ')' 
E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(85,1): error C2059: syntax error: ')' 
E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(103,25): error C2589: '(': illegal token on right side of '::' 
E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(103,1): error C2062: type 'unknown-type' unexpected 
E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(103,1): error C2059: syntax error: ')' 
E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(126,28): error C2589: '(': illegal token on right side of '::' 
E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(126,1): error C2062: type 'unknown-type' unexpected 
E:\vcpkg01\installed\x64-windows\include\amqpcpp\message.h(126,1): error C2059: syntax error: ')'

Expected behavior and actual behavior Can be linked normally and find the header file amqpcpp.h.

Sample code usage:

amqpcpp provides CMake targets:

    # this is heuristically generated, and may not be correct
    find_package(amqpcpp CONFIG REQUIRED)
    target_link_libraries(main PRIVATE amqpcpp)
CMakeFindUsage.cpp
#include <iostream>
#include "amqpcpp.hpp"

using namespace std;

int main()
{
        cout << "Hello CMake." << endl;
        return 0;
}
CMakeLists.txt
cmake_minimum_required (VERSION 3.8)

set(CMAKE_TOOLCHAIN_FILE "E:/vcpkg01/scripts/buildsystems/vcpkg.cmake")

project ("CMakeFindUsage")

add_library(main "CMakeFindUsage.cpp")

find_package(amqpcpp CONFIG REQUIRED)

target_link_libraries(main PRIVATE amqpcpp)

Reproduce environment:

Related PR: https://github.com/microsoft/vcpkg/pull/31271