Comments (3)
I write the following code to confirm that the boost and cmake all rightly installed on my machine.
Is there any conflict between muduo and boost?
ocean@hp:~/MYGIT/md/src$ cat CMakeLists.txt echo.cc
-------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)
project(echo CXX)
set(CXX_FLAGS
-g
# -DVALGRIND
# -DMUDUO_STD_STRING
-Wall
-Wextra
# -m32
-Werror
-Wconversion
-Wno-unused-parameter
-Wold-style-cast
-Woverloaded-virtual
-Wpointer-arith
-Wshadow
-Wwrite-strings
-march=native
-std=c++11
# -MMD
# -std=c++0x
-rdynamic
)
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_CXX_FLAGS_DEBUG "-O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -finline-limit=1000 -DNDEBUG")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH}})
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(echo ../src/echo.cc)
target_link_libraries(echo pthread rt)
-----------------------------------------------------------------------------
#include <boost/make_shared.hpp>
#include <stdio.h>
int main()
{
boost::shared_ptr<std::string> sp = boost::make_shared <std::string>("haha");
printf("%s\n", sp->c_str());
return 0;
}
---------------------------------------------------------------------------------
ocean@hp:~/MYGIT/md/src$ cmake . && make
-- The CXX compiler identification is GNU 4.8.4
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.54.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ocean/MYGIT/md/src
Scanning dependencies of target echo
[100%] Building CXX object CMakeFiles/echo.dir/echo.cc.o
Linking CXX executable echo
[100%] Built target echo
ocean@hp:~/MYGIT/md/src$ ./echo
haha
from muduo-tutorial.
I use the echo.cc to replace one file "muduo/examples/protobuf/codec/server.cc" then build, it report the same error. It seems the error was caused by the code in echo.cc.
ocean@hp:~/MYGIT/muduo/examples/protobuf/codec$ cp ../../../../muduo-tutorial/src/echo.cc server.cc
ocean@hp:~/MYGIT/muduo$ make -j8
--------------------------------------------------------------------------------------
/home/ocean/MYGIT/muduo/examples/protobuf/codec/server.cc:27:54: error: reference to ‘_1’ is ambiguous
boost::bind(&EchoServer::onConnection, this, _1));
from muduo-tutorial.
This tutorial works for muduo's master/cpp98 branches, not cpp11 branch.
from muduo-tutorial.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muduo-tutorial.