I am tring to compile OpenMCU in fedora 12. Since the orignal project was compiled in VC++, it has some compatiility issues with gcc.
I am using gcc 4.4.4 and febora 12.
The error shows somehting like this.
In file included from mcu.h:84,
from main.cxx:56:
filemembers.h:123: error: ISO C++ forbids declaration of ‘deque’ with no type
filemembers.h:123: error: typedef name may not be a nested-name-specifier
filemembers.h:123: error: expected ‘;’ before ‘<’ token
filemembers.h:124: error: ISO C++ forbids declaration of ‘FilenameList’ with no type
filemembers.h:124: error: expected ‘,’ or ‘...’ before ‘&’ token
In file included from mcu.h:84,
from main.cxx:56:
filemembers.h:149: error: ‘FilenameList’ does not name a type
make: *** [obj_linux_x86_r/main.o] Error 1
when checked in the source code of that perticular file it was something like this...
class ConferenceFileMember : public ConferenceMember
{
PCLASSINFO(ConferenceFileMember, ConferenceMember);
public:
ConferenceFileMember(Conference * conference, const PFilePath & _fn, PFile::OpenMode mode);
*typedef std::deque<PFilePath> FilenameList; //Line 123..*
ConferenceFileMember(Conference * conference, const FilenameList & _fns, PFile::OpenMode mode);
~ConferenceFileMember();
void Unlisten();
Seems to be a simple syntax issue. Can someone help me in this regards?
Thanx in advance..
Looks like std::deque is not defined. Did you #include <deque>?
Related
I am trying to build DeathStarBench (https://github.com/delimitrou/DeathStarBench), however, I am getting the following error:
In file included from /social-network-microservices/src/HomeTimelineService/HomeTimelineService.cpp:15:0:
/social-network-microservices/src/HomeTimelineService/HomeTimelineHandler.h: In member function 'virtual void social_network::HomeTimelineHandler::WriteHomeTimeline(int64_t, int64_t, int64_t, int64_t, const std::vector&, const std::mapstd::__cxx11::basic_string<char, std::__cxx11::basic_string >&)':
/social-network-microservices/src/HomeTimelineService/HomeTimelineHandler.h:129:55: error: 'class sw::redis::RedisCluster' has no member named 'get_shards_pool'
auto *shards_pool = _redis_cluster_client_pool->get_shards_pool();
I don't know anything about Redis. However, I googled the error message and couldn't find anything related to this. Any suggestions on what might be the problem?
Trying to build the Botan executable, I am getting the following error:
../src/cli/timing_tests.cpp: In static member function 'static Botan::RandomNumberGenerator& Botan_CLI::Timing_Test::timing_test_rng()':
../src/cli/timing_tests.cpp:100:17: error: 'AutoSeeded_RNG' does not name a type
static AutoSeeded_RNG static_timing_test_rng(Botan::Entropy_Sources::global_sources(), 0);
^~~~~~~~~~~~~~
../src/cli/timing_tests.cpp:101:17: error: 'static_timing_test_rng' was not declared in this scope
return static_timing_test_rng;
^~~~~~~~~~~~~~~~~~~~~~
../src/cli/timing_tests.cpp:101:17: note: suggested alternative: 'timing_test_rng'
return static_timing_test_rng;
^~~~~~~~~~~~~~~~~~~~~~
timing_test_rng
make: *** [Makefile:606: build/obj/cli/timing_tests.o] Error 1
this is the C++ code:
static Botan::RandomNumberGenerator& timing_test_rng()
{
#if defined(BOTAN_HAS_SYSTEM_RNG)
return Botan::system_rng();
#elif defined(BOTAN_HAS_AUTO_SEEDING_RNG)
static AutoSeeded_RNG static_timing_test_rng(Botan::Entropy_Sources::global_sources(), 0);
return static_timing_test_rng;
#else
// we could just use SHA-256 in OFB mode for these purposes
throw CLI_Error("Timing tests require a PRNG");
#endif
}
I am using these settings:
configure.py --prefix=$BUILD_DIR --with-external-includedir=$OPENSSL_PREFIX/include --with-external-libdir=$OPENSSL_PREFIX/lib --os=mingw --cpu=i386 --minimized-build --enable- modules=rsa,dsa,ecdsa,ed25519,hmac,hmac_drbg,mode_pad,bigint,filters,block,auto_rng,x509,cbc,dh --with-openssl
(building with mingw32, in Windows 10. Botan version 2.11.0)
I am pretty new on this. Any ideas?
EDIT: Changed to version 2.10.0, since 2.11.0 is not yet official, however the error did now change, to :
undefined reference to 'Botan::CPUID::state()'
Seems like adding entropy source system_rng solves this problem. Just add it to the enable-modules list. Got this from Jack Lloyd, creator of the Botan lib,
I have code that worked well in Visual C++ 6.0. Now I need to get it working in VS 2017. I have some error messages when I compile, and I'm really not sure how to fix it. Here's the code:
class CTagDB : public CObject
{
...
bool SameTag (const CTagDB *TagDB) { return TagDB && *this == *TagDB; }
...
}
class CTagsDB : public CObject
{
...
std::vector<CTagDB*> m_Tags;
...
}
bool CTagsDB::IsDup(const CTagDB *TagDB) const
{
return std::find_if(m_Tags.begin(), m_Tags.end(),
std::bind2nd(std::mem_fun1(CTagDB::SameTag),
TagDB)) != m_Tags.end();
}
For this code I get the following errors:
error C2039: 'mem_fun1': is not a member of 'std' C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\map(16):
note: see declaration of 'std'
error C3867: 'CTagDB::SameTag': non-standard syntax; use '&' to create a pointer to member
error C3861: 'mem_fun1': identifier not found
error C2672: 'std::find_if': no matching overloaded function found
error C2780: '_InIt std::find_if(_InIt,_InIt,_Pr)': expects 3 arguments - 2 provided
Seeing the methods begin() & end(), I suspect that there is a problem with the way the vectors are being used, because originally the code was written without iterators. But this fragment of code is so clever as to be very difficult to decipher, let alone maintain (by me).
Can anyone help me figure out what is going on here and how to fix it?
I have this one object that tries to call a function in another class's function. That function looks like this (Belongs to class 'Player' ):
void play(Game *const currentGame, int x, int y);
When I try to call this function from another object (of the Game class) like this :
player->play(this, x, y)
And during compilation I get these errors:
Error 1 error C2061: syntax error : identifier 'Game' c:\users\shaqed\documents\visual studio 2013\projects\exe3\tictactoe.h 24 1 Exe3
Error 3 error C2511: 'void Player::play(Game *const ,int,int)' : overloaded member function not found in 'Player' c:\users\shaqed\documents\visual studio 2013\projects\exe3\tictactoe.cpp 40 1 Exe3
Error 4 error C2660: 'Player::play' : function does not take 3 arguments c:\users\shaqed\documents\visual studio 2013\projects\exe3\tictactoe.cpp 158 1 Exe3
I came from Java, so maybe I lack some of the core principles about pointers and reference, however I could figure out why there's a type mismatch in here.
Thanks in advance
I have repeated your problem with the same compile errors. I think you have forgotten to add at the end of your method the body. Like:
void play(const Game *currentGame, int x, int y){}
When trying to compile a g++ project with the clang compiler, there is a strange error showing up.
Here is the snippet of the source file:
std::set<TTransportNetworkId> l_transportNetworkIds;
SelectionResultContainer l_searchResult = p_repo.rootMoc() / LnAny("LNBTS") / LnAny("LNMME");
BOOST_FOREACH(const SelectionResult & l_lnmmeSR, l_searchResult)
{
const MoLnmme & l_lnmme = l_lnmmeSR;
l_transportNetworkIds.insert(*l_lnmme.transportNwId);
}
The error message is:
conditional expression is ambiguous; 'rvalue_probe<Rrom::DataRep::SelectionResultContainer>' can be converted to 'Rrom::DataRep::SelectionResultContainer' and vice versa
BOOST_FOREACH(const SelectionResult & l_lnmmeSR, l_searchResult)
Conditions are:
The file compiles fine with gcc_4.3.2
clang in version 3.2 throws the above error
Already tried to include the latest boost library which results in the same error
My guess is that clang handles rvalue conditions differently than this gcc version does.
clang is supposed to be a drop-in-replacement for gcc, so how can one get rid of this error without touching the source file?
Are there any options in clang which somehow disables these kind of errors?!
UPDATE:
I could create an example source file, which you can reproduce for yourself:
#include <vector>
#include <boost/foreach.hpp>
class A : public std::vector<int>
{
public:
template <class T>
operator const T &() const;
};
void foo(){
A colA;
int b = 1;
BOOST_FOREACH(b, colA)
{
;
}
}
When compiled with clang 3.2 the above error is raised, with some additional insights to where exactly the error occurs:
error: conditional expression is ambiguous; 'rvalue_probe<A>' can be converted to 'A' and vice versa BOOST_FOREACH(b, colA)
expanded from macro 'BOOST_FOREACH' f (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL))
expanded from macro 'BOOST_FOREACH_CONTAIN' BOOST_FOREACH_EVALUATE(COL)
expanded from macro 'BOOST_FOREACH_EVALUATE' (true ? boost::foreach_detail_::make_probe((COL), BOOST_FOREACH_ID(_foreach_is_rvalue)) : (COL))
This code is compiled without errors with gcc_4.7.2.
Any ideas why the two compilers behave differently?
I found the solution in this document, see http://www.boost.org/doc/libs/1_43_0/boost/foreach.hpp
Snippet:
// Some compilers do not correctly implement the lvalue/rvalue conversion
// rules of the ternary conditional operator.
# if defined(BOOST_FOREACH_NO_RVALUE_DETECTION)
So, when providing a -DBOOST_FOREACH_NO_RVALUE_DETECTION definition option to clang, the error disappears.
Still the question remains whether gcc or clang is right or wrong on this point.