I'll be very pleased if you help.
My IDE is VS2010.
I'm using boost 1.47.0, especially boost::asio.
After some days of developing I decided to add log4cxx.
log4cxx needs to change calling convention to __stdcall
I surprisingly got lots of compiling error. They are ~ 70 errors.
I've googled a bit and found these:
#define BOOST_BIND_ENABLE_STDCALL
#define BOOST_MEM_FN_ENABLE_STDCALL
It helps. Now there are just ~10 errors.
Here there are:
1>ClCompile:
1> main.cpp
1>D:\Development\lib\boost_1_47_0\boost/detail/interlocked.hpp(61): error C2373: '_InterlockedCompareExchange' : redefinition; different type modifiers
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(214) : see declaration of '_InterlockedCompareExchange'
1>D:\Development\lib\boost_1_47_0\boost/detail/interlocked.hpp(62): error C2373: '_InterlockedExchange' : redefinition; different type modifiers
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(192) : see declaration of '_InterlockedExchange'
1>D:\Development\lib\boost_1_47_0\boost/detail/interlocked.hpp(63): error C2373: '_InterlockedExchangeAdd' : redefinition; different type modifiers
1> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\intrin.h(204) : see declaration of '_InterlockedExchangeAdd'
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C2446: '==' : no conversion from 'long' to 'long (__stdcall *)(volatile long *,long,long)'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C2040: '==' : 'long (__stdcall *)(volatile long *,long,long)' differs in levels of indirection from 'long'
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/sp_counted_base_w32.hpp(92): error C3861: '_InterlockedCompareExchange': identifier not found
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/spinlock_w32.hpp(62): error C3861: '_InterlockedExchange': identifier not found
1>D:\Development\lib\boost_1_47_0\boost/smart_ptr/detail/spinlock_w32.hpp(62): error C2440: 'initializing' : cannot convert from 'long (__stdcall *)(volatile long *,long)' to 'long'
1> There is no context in which this conversion is possible
1>D:\Development\lib\boost_1_47_0\boost/asio/detail/impl/signal_set_service.ipp(74): error C2664: 'signal' : cannot convert parameter 2 from 'void (__stdcall *)(int)' to 'void (__cdecl *)(int)'
1> None of the functions with this name in scope match the target type
1>D:\Development\lib\boost_1_47_0\boost/asio/detail/impl/signal_set_service.ipp(246): error C2664: 'signal' : cannot convert parameter 2 from 'void (__stdcall *)(int)' to 'void (__cdecl *)(int)'
1> None of the functions with this name in scope match the target type
1>main.cpp(20): warning C4007: 'main' : must be '__cdecl'
How can I solve them?
Any little ideas or hints?
You also need
#define BOOST_USE_WINDOWS_H
and possibly /Gz (__stdcall)
If your code looks something like:
#include "log4cxx/logger.h"
#include "log4cxx/basicconfigurator.h"
#include "log4cxx/helpers/exception.h"
using namespace log4cxx;
using namespace log4cxx::helpers;
int main()
{
//stuff
}
and you compile with -llog4cxx then you should be fine.
Related
I have a very similar problem to this one: How to resolve "fpclassify': ambiguous call to overloaded function
I have a large project with about 100 cpp-files and 100 header-files that work fine in Codeblocks using GNU GCC compiler, but I want to migrate the project to VS19. It seems to work fine except for one error: "fpclassify': ambiguous call to overloaded function
The error list in VS19 tells me it is located in corecrt_math.h on a return value at line 415:
template <class _Ty>
_Check_return_ inline bool isnan(_In_ _Ty _X) throw()
{
return fpclassify(_X) == FP_NAN;
}
When looking into my code I see that I use std::isna in 13 files, 24 locations (the error list does not refer to these places at all). However, unlike the problem that I linked to above, I do not see that I check if an int is na anywhere. Instead I have cases like this:
if (std::isnan(static_cast<double> (min)) && std::isnan(static_cast<double> (max)))
simulation_error("Error: No limits");
Where minand max are defined as const double & min = NAN and const double & max = NAN (min and max are set in the constructor).
Do you have any idea on how to find the error and how to solve it? I tried many hours yesterday - without any success.
Edit:
Full error message below:
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_math.h(415,1): error C2668: 'fpclassify': ambiguous call to overloaded function
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_math.h(300,31): message : could be 'int fpclassify(long double) noexcept'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_math.h(295,31): message : or 'int fpclassify(double) noexcept'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_math.h(290,31): message : or 'int fpclassify(float) noexcept'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_math.h(415,1): message : while trying to match the argument list '(_Ty)'
1> with
1> [
1> _Ty=bool
1> ]
1>C:\Users\Name\Documents\C++\Project name\Project name\src\module.cpp(668): message : see reference to function template instantiation 'bool isnan<bool>(_Ty) noexcept' being compiled
1> with
1> [
1> _Ty=bool
1> ]
Which refers to:
std::vector<double> stoprule_rel;,
if (!(std::isnan(static_cast<double> (stoprule_rel[i])
The error message like fpclassify': ambiguous call to overloaded function is always accompanied by notes. For example, for a simple program
#include <cmath>
int main() {
std::isnan(5);
}
VS complains:
corecrt_math.h(415): error C2668: 'fpclassify': ambiguous call to overloaded function
corecrt_math.h(300): note: could be 'int fpclassify(long double) throw()'
corecrt_math.h(295): note: or 'int fpclassify(double) throw()'
corecrt_math.h(290): note: or 'int fpclassify(float) throw()'
corecrt_math.h(415): note: while trying to match the argument list '(_Ty)'
with [ _Ty=int ]
<source>(3): note: see reference to function template instantiation 'bool isnan<int>(_Ty) throw()' being compiled
with [ _Ty=int ]
From these notes we can infer that _Ty is int and that std::nan was called on the line 3 of our source code. Take a look at the full compiler output for your compilation, it will tell you the exact place in your code where the error is triggered.
After downloading this https://github.com/pybind/pybind11/archive/v2.2.3.zip
and creating a simple cpp file:
#include <pybind11/pybind11.h>
int add(int i, int j) { return i + j; }
PYBIND11_MODULE(example, m) {
m.doc() = "pybind11 example plugin"; // optional module docstring
m.def("add", &add, "A function which adds two numbers");
}
with
I get this error
Error C2446 '<': no conversion from 'unsigned __int64' to 'unsigned __int64 *' in c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector line 2326
Would anybody know what this could be referring to, and possibly how to fix it?
As requested, here the full error log:
1>------ Rebuild All started: Project: Test_CreatePythonBindings, Configuration: Debug x64 ------
1>example.cpp
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2326): error C2446: '<': no conversion from 'unsigned __int64' to 'unsigned __int64 *'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2326): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2325): note: while compiling class template member function 'std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>> &std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>::operator +=(__int64)'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2545): note: see reference to function template instantiation 'std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>> &std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>::operator +=(__int64)' being compiled
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2490): note: see reference to class template instantiation 'std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>' being compiled
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(3094): note: see reference to class template instantiation 'std::_Vb_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>' being compiled
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(3093): note: while compiling class template member function 'void std::vector<bool,std::allocator<_Ty>>::push_back(const bool &)'
1> with
1> [
1> _Ty=bool
1> ]
1>c:\pybind11-2.2.3\include\pybind11\pybind11.h(513): note: see reference to function template instantiation 'void std::vector<bool,std::allocator<_Ty>>::push_back(const bool &)' being compiled
1> with
1> [
1> _Ty=bool
1> ]
1>c:\pybind11-2.2.3\include\pybind11\cast.h(1806): note: see reference to class template instantiation 'std::vector<bool,std::allocator<_Ty>>' being compiled
1> with
1> [
1> _Ty=bool
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2326): warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
1>Done building project "Test_CreatePythonBindings.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
It appears to be a VS 2017 issue related to
std::vector<bool>
Separate question asked here:
Pushback on vector<bool> fails - VS 2017
I have added sqlite3.c file into my project.
And #include. Here is the code:
#include <sqlite3.h>
using namespace std;
int main()
{
return 0;
}
I compile the program and it throws the following error:
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(15705): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(19741): error C2440: '=' : cannot convert from 'void *' to 'sqlite3_mutex *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(20665): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(20677): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(21142): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(21256): error C2440: '=' : cannot convert from 'void *' to 'char *'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>..\..\..\..\..\..\..\libraries\sqlite-amalgamation-3080702\sqlite3.c(21411): error C2440: '=' : cannot convert from 'void *' to 'char *'
But there is no error that a header or file is not found. Everything is found and the errors are just outputted above
I have found the solution. I compiled the C code as C++, but changing it was not enough.
I write it for future visitors:
First, I had to change file's (ONLY FILE) property. Right-click on the file and select properties, under the C/C++, select Advanced and then select Compile As and set it to C (neither default nor C++).
Then, you should make sure that your .c file is compiled without clr. Well, to do that, under the same C/C++ set of menu, select "Common Langugae Runtime Support" and set it to No Support....
I'm using Visual Studio 17 and I would add to this, find the settings for "Precompiled Header" and set that to "Not Using Precompiled Headers".
I'm trying to declare an object in c++:
Polygon poly;
and the compiler is telling that that "Polygon is ambigious". What does that mean?
Here is the full code:
#include "Graph.h"
#include "Simple_window.h"
#include "point.h"
#include "Window.h"
using namespace Graph_lib;
int main(int argc, char **argv)
{
Point tl(100,100);
Simple_window win(tl,600,400,"canvas");
Axis xa(Axis::x, Point(20,300),280 ,10, "x axis");
win.attach(xa);
win.set_label("canvas #2");
win.wait_for_button();
Axis ya(Axis::y, Point(20,300),280 ,10, "y axis");
ya.set_color(Color::cyan);
ya.label.set_color(Color::dark_red);
win.attach(ya);
win.set_label("canvas #3");
win.wait_for_button();
Function sine(sin,0,100, Point(20,150),1000,50,50);
win.attach(sine);
win.set_label("canvas #4");
win.wait_for_button();
sine.set_color(Color::blue);
Polygon poly; ///ERROR! Ambigious!!!
poly.add(Point(300,200));
poly.add(Point(350,100));
poly.add(Point(400,200));
poly.set_color(Color::red);
poly.set_style(Line_style::dash);
win.attach(poly);
win.set_label("canvas #5");
win.wait_for_button();
}
As you can see there's a conflict between the user written header, and some header included some where. This is after have recently installed FLTK 1.3.
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1> Graph.cpp
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.cpp(65): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.cpp(131): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.cpp(132): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.cpp(389): warning C4800: 'void *' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.cpp(414): warning C4018: '>=' : signed/unsigned mismatch
1> GUI.cpp
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(107): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(112): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(117): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(130): warning C4018: '<' : signed/unsigned mismatch
1> c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(130) : while compiling class template member function 'Graph_lib::Vector_ref<T>::~Vector_ref(void)'
1> with
1> [
1> T=Graph_lib::Button
1> ]
1> c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(99) : see reference to class template instantiation 'Graph_lib::Vector_ref<T>' being compiled
1> with
1> [
1> T=Graph_lib::Button
1> ]
1> Simple_window.cpp
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(107): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(112): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(117): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(130): warning C4018: '<' : signed/unsigned mismatch
1> c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(130) : while compiling class template member function 'Graph_lib::Vector_ref<T>::~Vector_ref(void)'
1> with
1> [
1> T=Graph_lib::Button
1> ]
1> c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(99) : see reference to class template instantiation 'Graph_lib::Vector_ref<T>' being compiled
1> with
1> [
1> T=Graph_lib::Button
1> ]
1> test.cpp
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(107): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(112): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(117): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(36): error C2872: 'Polygon' : ambiguous symbol
1> could be 'c:\program files (x86)\microsoft sdks\windows\v7.0a\include\wingdi.h(4548) : BOOL Polygon(HDC,const POINT *,int)'
1> or 'c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(256) : Graph_lib::Polygon'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(36): error C2872: 'Polygon' : ambiguous symbol
1> could be 'c:\program files (x86)\microsoft sdks\windows\v7.0a\include\wingdi.h(4548) : BOOL Polygon(HDC,const POINT *,int)'
1> or 'c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(256) : Graph_lib::Polygon'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(36): error C2146: syntax error : missing ';' before identifier 'poly'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(36): warning C4551: function call missing argument list
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(36): error C2065: 'poly' : undeclared identifier
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(37): error C2065: 'poly' : undeclared identifier
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(37): error C2228: left of '.add' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(38): error C2065: 'poly' : undeclared identifier
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(38): error C2228: left of '.add' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(39): error C2065: 'poly' : undeclared identifier
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(39): error C2228: left of '.add' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(41): error C2065: 'poly' : undeclared identifier
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(41): error C2228: left of '.set_color' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(42): error C2065: 'poly' : undeclared identifier
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(42): error C2228: left of '.set_style' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\test.cpp(43): error C2065: 'poly' : undeclared identifier
1> Window.cpp
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(45): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(47): warning C4309: 'initializing' : truncation of constant value
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(107): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(112): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(117): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\window.cpp(74): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\window.cpp(76): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(130): warning C4018: '<' : signed/unsigned mismatch
1> c:\users\bryan\documents\visual studio 2010\projects\test\test\graph.h(130) : while compiling class template member function 'Graph_lib::Vector_ref<T>::~Vector_ref(void)'
1> with
1> [
1> T=Graph_lib::Button
1> ]
1> c:\users\bryan\documents\visual studio 2010\projects\test\test\gui.h(99) : see reference to class template instantiation 'Graph_lib::Vector_ref<T>' being compiled
1> with
1> [
1> T=Graph_lib::Button
1> ]
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
It means that you've declared two or more entities (types, functions, variables, etc.) called Polygon, and the compiler can't tell which you mean in this context.
The complete error message should tell you which declarations are causing the ambiguity. Without seeing them, it's hard to guess how best to fix the error.
UPDATE: Now you've posted some code, but not the complete error message or the problematic declarations, I'll hazard a guess that Polygon is declared in both the global and Graph_lib namespaces. You then dump the whole of Graph_lib into the global namespace, making the name ambiguous. If this is the case, then you'll need to specify ::Polygon or Grapg_lib::Polygon to resolve the ambiguity.
because there also have a Polygon defined in wingdi.h
THE SOLUTION IS Put NOGDI in preprocessor. In Visual Studio Project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions -> add NOGDI.
I am trying to build this program:
#include "stdafx.h"
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/file_mapping.hpp>
#include <boost/interprocess/mapped_region.hpp>
using namespace std;
int main()
{
using boost::interprocess;
// Create the file mapping
file_mapping fm("input.dat", read_only);
// Map the file in memory
mapped_region region(fm, read_only);
// Get the address where the file has been mapped
float * addr = (float *)region.get_address();
std::size_t elements = region.get_size() / sizeof(float);
}
But I am having two problems, for the main I am getting:
1>tasker.cpp(98): error C2873: 'boost::interprocess' : symbol cannot be used in a using-declaration
1>tasker.cpp(101): error C2065: 'file_mapping' : undeclared identifier
1>tasker.cpp(101): error C2146: syntax error : missing ';' before identifier 'fm'
1>tasker.cpp(101): error C2065: 'read_only' : undeclared identifier
1>tasker.cpp(101): error C3861: 'fm': identifier not found
1>tasker.cpp(103): error C2065: 'mapped_region' : undeclared identifier
1>tasker.cpp(103): error C2146: syntax error : missing ';' before identifier 'region'
1>tasker.cpp(103): error C2065: 'fm' : undeclared identifier
1>tasker.cpp(103): error C2065: 'read_only' : undeclared identifier
1>tasker.cpp(103): error C3861: 'region': identifier not found
1>tasker.cpp(105): error C2065: 'region' : undeclared identifier
1>tasker.cpp(105): error C2228: left of '.get_address' must have class/struct/union
1> type is 'unknown-type'
1>tasker.cpp(106): error C2065: 'region' : undeclared identifier
1>tasker.cpp(106): error C2228: left of '.get_size' must have class/struct/union
1> type is 'unknown-type'
and for the #include <boost/interprocess/mapped_region.hpp> I am getting
1>C:\Users\Mike\Documents\boost_1_55_0\boost/intrusive/detail/has_member_function_callable_with.hpp(200): error C2228: left of '.select_on_container_copy_construction' must have class/struct/union
1> type is 'boost::move_detail::add_rvalue_reference<U>::type'
1> C:\Users\Mike\Documents\boost_1_55_0\boost/intrusive/detail/has_member_function_callable_with.hpp(276) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_select_on_container_copy_construction_impl<Fun,true,>' being compiled
1> with
1> [
1> Fun=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const ,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>>>>
1> ]
1> C:\Users\Mike\Documents\boost_1_55_0\boost/container/allocator_traits.hpp(262) : see reference to class template instantiation 'boost::container::container_detail::has_member_function_callable_with_select_on_container_copy_construction<const Alloc,>' being compiled
1> with
1> [
1> Alloc=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const ,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>>>>
1> ]
1> C:\Users\Mike\Documents\boost_1_55_0\boost/container/detail/tree.hpp(217) : see reference to class template instantiation 'boost::container::allocator_traits<A>' being compiled
1> with
1> [
1> A=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const ,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>>>>
1> ]
1> C:\Users\Mike\Documents\boost_1_55_0\boost/container/detail/tree.hpp(246) : see reference to class template instantiation 'boost::container::container_detail::intrusive_rbtree_type<A,boost::container::container_detail::tree_value_compare<Key,std::pair<const Key,T>,Compare,boost::container::container_detail::select1st<std::pair<const Key,T>>>>' being compiled
1> with
1> [
1> A=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const ,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>>>>
1> , Key=const boost::interprocess::ipcdetail::sync_id *
1> , T=boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>>
1> , Compare=boost::interprocess::ipcdetail::sync_handles::address_less
1> ]
1> C:\Users\Mike\Documents\boost_1_55_0\boost/container/map.hpp(83) : see reference to class template instantiation 'boost::container::container_detail::rbtree<Key,std::pair<const Key,T>,boost::container::container_detail::select1st<std::pair<const Key,T>>,Compare,Allocator>' being compiled
1> with
1> [
1> Key=const boost::interprocess::ipcdetail::sync_id *
1> , T=boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>>
1> , Compare=boost::interprocess::ipcdetail::sync_handles::address_less
1> , Allocator=std::allocator<std::pair<const boost::interprocess::ipcdetail::sync_id *const ,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<std::pair<const boost::interprocess::ipcdetail::sync_id,void *>>>>>
1> ]
1> C:\Users\Mike\Documents\boost_1_55_0\boost/interprocess/sync/windows/sync_utils.hpp(226) : see reference to class template instantiation 'boost::container::map<const boost::interprocess::ipcdetail::sync_id *,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<T>>,boost::interprocess::ipcdetail::sync_handles::address_less,std::allocator<std::pair<const Key,boost::unordered::iterator_detail::iterator<boost::unordered::detail::ptr_node<T>>>>>' being compiled
1> with
1> [
1> T=std::pair<const boost::interprocess::ipcdetail::sync_id,void *>
1> , Key=const boost::interprocess::ipcdetail::sync_id *
1> ]
I am using Visual Studio Express 2013 for Windows Desktop, and boost 1.55.0.
I tried other boost libraries and work without any issue.... Also, I am using the x64 release build.
Boost 1.55 does not fully supports Visual Studio 2013 compiler yet.
Either:
use Visual Studio 2012 toolchain
or try to get latest source from svn co http://svn.boost.org/svn/boost/trunk boost-trunk
or patch boost yourself (don't forget to upload your patch)
or wait until someone will patch it. You can speed it up by submitting bug report
Edit
Just checked boost-trunk, with boost/intrusive/detail/has_member_function_callable_with.hpp already patched and it compiles fine with both vs2013 and vs2013-nov-2013-ctp toolchains. So, try it. And, if you have multiple boost versions, don't forget to change include paths (in Makefile or VC project properties) as I did. ;)
Note, that, obviously, latest development code can be unstable. Do not use it for end-user production.
Try changing this:
using boost::interprocess;
to this:
using namespace boost::interprocess;
(Ref: Example in http://www.boost.org/doc/libs/1_55_0/doc/html/interprocess/quick_guide.html )
Yeah. you need to say "using namespace boost::interprocess;"
Fix that and you should be good.