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

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?

Related

Declaring a static pointer in class [duplicate]

While compiling on x64 plattform I am getting following error:
c:\codavs05\hpsw-sc\ovpacc\tools\codaaccesstest\coda_access.cpp(1572): fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\sizeopt.c', line 55)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
------ Build started: Project: asyncexample, Configuration: Release Win32 ------
If I change settings to preprocessor file (Yes) i am not getting any error.
About my environment: Upgrading Microsoft Visual Studio 2005 to 2010
Please help.
I have had this problem with VS2015 while building locally in Windows.
In order to solve it, I deleted my build folder (Output Directory as seen in Properties/General) and rebuilt the project.
This always seems to help when strange things happen during the build.
I’ve encountered this error many times in VC++. Do the following steps. They’ve sometimes helped me with this issue:
Take a look at the exact location, pointed out by compiler error.
Find any external types or classes used there at that location.
Change the order of “include path” of those files found in step 2 and rebuild the solution.
I hope that help !!!!
I am getting same error with VC2012. Setting up the project properties Optimization to Disabled (/Od) resolved the issue.
In my solution, i've removed output dll file of the project, and I've made project rebuild.
I encountered the same error and spent quite a bit of time hunting for the problem. Finally I discovered that function that the error was pointing to had an infinite while loop. Fixed that and the error went away.
In my case was the use of a static lambda function with a QStringList argument. If I commented the regions where the QStringList was used the file compiled, otherwise the compiler reported the C1001 error. Changing the lambda function to non-static solved the problem (obviously other options could have been to use a global function within an anonymous namespace or a static private method of the class).
I got this error using boost library with VS2017. Cleaning the solution and rebuilding it, solved the problem.
I also had this problem while upgrading from VS2008 to VS2010.
To fix, I have to install a VS2008 patch (KB976656).
Maybe there is a similar patch for VS2005 ?
I got the same error, but with a different file referenced in the error message, on a VS 2015 / x64 / Win7 build. In my case the file was main.cpp. Fixing it for me was as easy as doing a rebuild all (and finding something else to do while the million plus lines of code got processed).
Update: it turns out the root cause is my hard drive is failing. After other symptoms prompted me to run chkdsk, I discovered that most of the bad sectors that were replaced were in .obj, .pdb, and other compiler-generated files.
I got this one with code during refactoring with a lack of care (and with templates, it case that was what made an ICE rather than a normal compile time error)
Simplified code:
void myFunction() {
using std::is_same_v;
for (auto i ...) {
myOtherFunction(..., i);
}
}
void myOtherFunction(..., size_t idx) {
// no statement using std::is_same_v;
if constexpr (is_same_v<T, char>) {
...
}
}
I had this error when I was compiling to a x64 target.
Changing to x86 let me compile the program.
Sometimes helps reordering the code. I had once this error in Visual Studio 2013 and this was only solved by reordering the members of the class (I had an enum member, few strings members and some more enum members of the same enum class. It only compiled after I've put the enum members first).
In my case, this was causing the problem:
std::count_if(data.cbegin(), data.cend(), [](const auto& el) { return el.t == t; });
Changing auto to the explicit type fixed the problem.
Had similar problem with Visual Studio 2017 after switching to C++17:
boost/mpl/aux_/preprocessed/plain/full_lambda.hpp(203): fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'msc1.cpp', line 1518)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
Solved by using Visual Studio 2019.
I first encountered this problem when i was trying to allocate memory to a char* using new char['size']{'text'}, but removing the braces and the text between them solved my problem (just new char['size'];)
Another fix on Windows 10 if you have WSL installed is to disable LxssManager service and reboot the PC.

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

Not all components required for linking are present on the command line

I'm trying to use Intel Threading Building Blocks using Intel Parallel Studio XE 2013 (Intel C++ 14.0 project). I have the following to my code
#include <tbb/tbb.h>
using namespace tbb;
and am trying to operate on a map<char, concurrent_vector<int>> stats, specifically to perform an operation such as stats[x].push_back(y).
and have set the 'Use Intel TBB' option in project properties. When I try to compile, I get an error saying
Error 10 error #11023: Not all components required for linking are present on command line C:\Dropbox\Projects\Games\Preference\Preference\ipo Preference (Intel C++ 14.0)
With subsequent errors complaining that I have unresolved externals such as tbb::internal::concurrent_vector_base_v::internal_push_back(...).
How can I fix this?
It seems you need to include tbb_debug.lib into you linking process or to disable auto-linkage to it. Try defining __TBB_NO_IMPLICIT_LINKAGE

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

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.

updating boost libraries for Rad Studio

I need to update boost libraries to version 1_46, currently Rad Studio XE/2010 have 1_39 version. When I try just to overwrite boost include path compile fails with various errors from Borland VCL. When i try to add new boost libs in other path keep previous version it also fails with compile condition errors when constructing std::* classes.
I need shared_memory_manager support that is available only in new boost versions. Is there any other ways to upgrade boost libraries or use shared memory that will be available to same processes?
Compilation errors when compiling with new boost version only:
[BCC32 Error] bad_weak_ptr.hpp(44): E2113 Virtual function 'bad_weak_ptr::what() const throw()' conflicts with base class 'std::exception'
[BCC32 Error] xlocale(953): E2228 Too many error or warning messages
There are dozens of locations inside of boost which check the compiler version in order to determine whether or not certain workarounds are needed. (checking against both __CODEGEARC__ and __BORLANDC__) You need to test each of these and update the version number as appropriate. Also there are a number of defines set inside the config/compiler/codegear.hpp file (typically BOOST_HAS_* and BOOST_NO_*) which you also need to turn on/off for different versions of the compiler.
It is a very tricky and time consuming process.