Boost::asio -- UnregisterWaitEx' has not been declared - c++

I'm trying to build a program that will be able to read and write to a Serial Port.
At the moment I am using a wrapper class that works with boost::asio.
( http://gitorious.org/serial-port )
I'm getting a bunch of errors from win_object_handle_service.ipp (from boost asio)
The error Message i get is at http://pastebin.com/MtcC61cb
Additionally, in the AsyncSerial.hpp file from the SerialPort Library
I get an error on line 103:
thread t(boost::bind(&asio::io_service::run, &pimpl->io))
There is nothing in the compilers error log, but eclipse reports that:
boost::bind is ambiguous
invalid overload of 'asio::io_service::run'
I'm not sure if the above are valid errors, or if its just eclipse's indexer being stupid
My Question is:
Can anyone help to figure out why I am getting this error message, and how I can get my program to compile?
I'm also welcome to suggestions for a different Serial library. However I would need it to be cross platform.
I'm running windows 7 x64 compiling with MinGW 4.7.1 (32 bit).

I had this problem compiling the chat_client from the boost examples
it was:
boost::thread t(boost::bind(&boost::asio::io_service::run, &io_service));
and i changed it to use an explicit cast:
boost::thread t(boost::bind((unsigned long int (boost::asio::io_service::*)())&boost::asio::io_service::run, &io_service));
And the compile errors went away

I found that to fix these ambiguities, you need to turn off Eclipse's added compile errors:
Project Properties -> C/C++ General -> Code Analysis.
Turn on Use project settings
Then disable the relevant Eclipse errors, eg. Ambiguity.

Related

CGAL on Codeblock, compiler error

I'm trying to run the example "Scale_Space_Surface_Reconstruction_3" from CGAL library on CodeBlocks IDE on Ubuntu platform, as it would be nice
to have the IDE support for code completion and a more automatic configuration process.
I managed to successfully execute it by compiling it with cmake on the terminal window.
However, on CodeBlocks, after creating a new project and copying the code from the example, I get the following error:
/usr/local/include/CGAL/Scale_Space_Reconstruction_3/Scale_Space_Surface_Reconstruction_Impl_3.h:165:23: error: variable or field 'pca' declared void
Approximation pca( _nn[i]);
By looking inside the code, I found out that this is due to an undefined Macro CGAL_EIGEN3_ENABLED. As my experiment shows, if I define the macro at
pre-processing time, I do not get the same error. That is because, by defining the macro, the type definition Default::Get< wA,void>::type, becomes
Default::Get< wA, Weighted_PCA_approximation_3<Gt>>::type, and the compiler does not complain any more.
Unfortunately, as a deserved prize for messing with things I do not really understand, I get a segmentation fault at runtime.
How should I change the compiler options of codeBlocks to make the compilation succeed, and the executable run successfully?
I have the following include paths:
/usr/local/lib/CGAL/ /usr/local/include /usr/include /usr/include/eigen3.
I also included the following libraries:
libCGAL.so, libCGAL_Core.so, libCGAL_ImageIO.so, libgmp.so, libmpfr.so, libtbb.so, libtbbmalloc.so, libtbbmalloc_proxy.so

error: ‘fileno’ was not declared in this scope

I am running Cygwin on windows 8, attempting to compile the source code for a game I would like to mod. Unfortunately I am running into some errors while building involving the fileno function. After doing some googling It seems like the problem might have to do with c++11 support (I'm not really sure what this means). Most of the solutions people have found involve adding some option like -std=c++0x or -std=c++11 when compiling, but my attempts to add the options into the makefile have been unsuccessful, and I don't know if that's whats causing the problem anyways. I'll include the code snippet that's throwing the error and a link to the makefile as it is quite large. Any advice you could give me would be great.
code that throws error:
time_t file_modtime(FILE *f)
{
struct stat filestat;
if (fstat(fileno(f), &filestat))
return 0;
return filestat.st_mtime;
}
Link to Makefile
it is being hosted on github
EDIT: After getting some advice I poked around the makefile and found five instances where the -std option was used, playing around with them hasn't changed anything. Is the problem with my Cygwin configuration? I installed the packages I was told I would need in the installation guide for the game I am building.
Changing the -std=c*** in your makefile to -std=gnu++0x should fix your problem.
If you don't know what c++11 is you're most likely not using it anyway.
Also if you need c++11 support you can also do: -std=gnu++11 instead of -std=gnu++0x
For windows...
fileno() is deprecated: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/posix-fileno?view=vs-2017
use _fileno() instead: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/fileno?view=vs-2017

Eclipse complains method c_str could not be resolved

How can my program compile successfully but eclipse shows me "Semantic Errors" and how could I get rid of those errors?
The error messages I have are the following
Method 'c_str' could not be resolved (this happens also for compare and size on strings)
Here an example:
std::string someotherstring = "test";
std::string name = someotherstring.c_str();
The problem here is that it also creates follow up errors which seem all to be not true, my software compiles and runs as intended and even uses the "c_str()" returns to process messages. It seems only to be a display issue in Eclipse.
I have searched now for hours, tried to use a custom indexer but for some reason it won't go away. Maybe someone else has a good idea what to do here as Google spits out nothing about this specific problem. (I have even tried to use different C++11 standard flags as I thought it might had an impact)
I had the same problem. Solved by simply run a index -> rebuild. You can find that by clicking on the project main folder with the right button.
Cheers
If you're building your projects using mingw and using C++11, you can not use the default dialect option of -std=c++0x.
Click on 'GCC C++ Compiler' and in the Command: textbox, enter -std=gnu++0x after the g++

How to fix "no member named 'somefunction' in the global namespace"

Environment: Windows 7, Visual Studio 2012, Pepper_34
We have an application that requires parallel processing. We used to use TBB for that. Now porting to PNaCl, we wanted to use this opportunity to switch to using a thread pool built around std::thread in C++11.
Before making the switch, the application (not using TBB) builds for PNaCl without errors.
We know that we will need C++11 for the new thread pool so I enabled C++11 with the command line -std=c++11.
Now I get several errors similar to:
T:\nacl_sdk\pepper_34\toolchain\win_pnacl\usr\include\c++\v1\cstdio(138,9): error : no member named 'snprintf' in the global namespace
So I'm surely missing a compile flag, a command line argument, a pathname or something because this error is generated from compiling cstdio.
Same kind of error when compiling
T:\nacl_sdk\pepper_34\toolchain\win_pnacl\usr\include\c++\v1\__locale and
T:\nacl_sdk\pepper_34\toolchain\win_pnacl\usr\include\c++\v1\locale
Are those pathnames correct?
So my question is what am I missing here to get rid of those errors?

Error LNK1223 on ARM builds

eMbedded Visual C++ 3 project, that is building for PocketPC 2000. On the ARM build, the linker throws the following error:
fatal error LNK1223: invalid or corrupt file: file contains invalid pdata contributions
On SH3, the project compiles, links, and works. The project also works when built for ARM on Visual C++ 2005, but I need to test builds specifically from eVC3.
Any ideas, please? What's a pdata contribution and how do I affect (or disable) those? It's something to do with exception handling; I've tried disabling SEH by specifying /EHsc, to no effect.
Very weird. I tried commenting out everything in the file. The error went away when I commented out a function that was extern "C" void __declspec(naked) with no body (body #ifdef'fed away). I have similar functions in the project, but they did not throw any errors like this. Maybe a compiler bug...
No idea from me, but the Google-mind dredged up this thread which might give you a clue how to fix/workaround the problem... maybe:
http://www.pocketpcjunkies.com/Uwe/Forum.aspx/wince-pb/7477/Link-error-during-DEBUG-build
After looking at the error more closely, I finally figured out that this is
a side-effect of my hijacking of SC_SetDaylightTime() in the kernel with my
own version. Apparently, something that I'm doing in my code there is
causing the compiler to generate pdata entries that are wrong in some way.
A strategically-placed #ifndef worked around it.