![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
shelleyHLX
这个作者很懒,什么都没留下…
展开
-
在ubuntu中编译C++代码的两种方法--cmake-g++
作为初学者,按照博客上的内容,编译运行第一个C++程序时,出现了很多低级的错误,希望能全部写出来,年纪大了,记性不好,免得以后忘记。使用系统Ubuntu18.04. cmake 和 gcc 都已经安装完成,这里不介绍安装方法,仅仅描述按照网上教程出现的问题。从收集的资源看有两种方法:1 :cmake 2:g++1.cmake网上有官方教程,英文版:请看https://cmake.org/cmake-tutorial/使用cmake首先得有个CMakeList.txt文件,你需要把配置信.转载 2020-12-31 16:06:29 · 720 阅读 · 0 评论 -
C++中debug和release的区别 . 转载
vc中debug和release的不同 收藏在使用VC开发软件的过程中,正当要享受那种兴奋的时候突然发现:release与debug运行结果不一致,甚至出错,而release又不方便调试,真的是当头一棒啊,可是疼归疼,问题总要解决,下面将讲述一下我的几点经验,看看是不是其中之一:https://www.cnblogs.com/yymn/p/4454438.html1. 变量。大家都知道,debug跟release在初始化变量时所做的操作是不同的,debug是将每个字节位都赋成0xcc(注1),而.转载 2020-12-30 17:58:45 · 2005 阅读 · 0 评论 -
vscode C++开发环境配置教程(教你如何用vscode写C++)
Update: 2020.6.26 大家在安装TDM-GCC别忘了勾选gbd64文件,感谢这位朋友提出的错误 链接已更新 个人邮箱:qhmrbhll@qq.com,有问题请私信我,最好附上截图。 用了一段时间的cb,Devc++,但一直感觉cb的高亮太差,而Devc++使用体验差(尤其是代码补全功能),换过vs2017,但是由于其太大了,卡顿十分明显,所以最终选择了vscode这款轻量级编译器。由于自己在配置c++开发环境时遇到了不少问题,因此特地写了这篇博文,希望能转载 2020-10-22 14:50:57 · 3588 阅读 · 2 评论 -
揭秘如何将基于 C/C++ 的项目从 Windows 移植到 UNIX(1)
文章目录从 Windows 移植到 UNIX 环境Visual Studio 中的 C/C++ 项目类型将 DLL 移植到 UNIX 环境g++ 中的符号隐藏g++ 中的属性机制概述在 UNIX 环境中显式加载 DLL 或者共享对象Windows 和 UNIX 环境中的 DLL 搜索路径将静态库从 Windows 移植到 UNIX预编译头文件reference从 Windows 移植到 UNIX...转载 2020-02-17 17:23:15 · 445 阅读 · 0 评论 -
ubuntu:python调用c生成so文件出错
bfs.cpp:11:15: error: expected constructor, destructor, or type conversion before ‘(’ token __declspec(dllexport)windows到linux的转换:windows下:#include <stdio.h>#include <vector>...原创 2020-02-17 17:16:36 · 665 阅读 · 0 评论 -
GCC与gcc,g++区别
看的Linux公社的一篇文章,觉得不错,内容复制过来了。其实在这之前,我一直以为gcc和g++是一个东西,只是有两个不同的名字而已,今天在linux下编译一个c代码时出现了错误才找了一下gcc和g++的区别。先描述一下今天遇到的错误:因为以前写程序的时候,写的都是cpp文件,然后就直接使用g++编译,没出错,也就没有在意过这些问题,今天有一个c文件,但里面包含后STL中的vector语...转载 2020-01-15 10:54:32 · 250 阅读 · 0 评论 -
OSError: ./libtest4.so: undefined symbol: _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
python开放的接口要用extern “C”修饰,否则python脚本里会找不到函数,比如test.cpp代码里的foo()函数。还有,一定要用g++编译C++代码,不然会报类似“OSError: ./libtest4.so: undefined symbol: _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_”这样的错误,因为...原创 2020-01-15 10:28:59 · 1781 阅读 · 0 评论 -
ubuntu16.04安装最好用的C/C++IDE--Code::Blocks
在ubuntu中写C/C++代码中,总感觉编译代码的时候比较繁琐,因此就在ubuntu系统中安装Code::Blocks,安装非常简单,安装步骤如下:1.添加Code::Blocks对应的源sudo add-apt-repository ppa:damien-moore/codeblocks-stable2.更新源sudo apt-get update3.安装Code::Blo...转载 2020-01-15 10:18:07 · 406 阅读 · 0 评论 -
C++ main函数中参数argc和argv含义及用法
C++ main函数中参数argc和argv含义及用法:https://blog.csdn.net/dcrmg/article/details/51987413原创 2020-01-14 17:14:58 · 512 阅读 · 0 评论 -
古风排版
Problem A: 古风排版Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 24 Solved: 10[Submit][Status][Web Board]Description中国的古人写文字,是从右向左竖向排版的。本题就请你编写程序,把一段文字按古风排版。Input输入在第一行给出一个正整数N(原创 2017-03-31 19:05:36 · 636 阅读 · 0 评论 -
vector erase() and clear() in C++ -- vector的函数erase()和clear()
Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. vector和动态数组一...原创 2019-01-16 09:41:12 · 1365 阅读 · 0 评论 -
vector::push_back() and vector::pop_back() in C++ STL
Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container.vector::pus...原创 2019-01-16 10:02:21 · 1377 阅读 · 0 评论 -
vector::front() and vector::back() in C++ STL
Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container.vector::fro...原创 2019-01-16 10:38:55 · 444 阅读 · 0 评论 -
vector::empty() and vector::size() in C++ STL
Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container.vector::emp...原创 2019-01-16 10:53:46 · 992 阅读 · 0 评论 -
Initialize a vector in C++ (5 different ways) -- 初始化vector的5种方法
Following are different ways to create and initialize a vector in C++ STL1, Initializing by one by one pushing values : 一个一个初始化// CPP program to create an empty vector // and one by one push val...原创 2019-01-16 11:03:38 · 1608 阅读 · 0 评论 -
Passing vector to a function in C++ 传递vector到函数
When we pass an array to a function, a pointer is actually passed. When a vector is passed to a function, a copy of the vector is created. For example, we can see below program, changes made inside ...原创 2019-01-16 11:15:46 · 659 阅读 · 0 评论 -
Priority Queue in C++ Standard Template Library (STL)
Priority queues are a type of container adapters, specifically designed such that the first element of the queue is the greatest of all elements in the queue and elements are in non decreasing order(h...原创 2019-01-22 14:21:02 · 257 阅读 · 0 评论 -
Stack in C++ STL
Stacks are a type of container adaptors with LIFO(Last In First Out) type of working, where a new element is added at one end and (top) an element is removed from that end only. 栈是后进先出,只在一端进行插入删除。 T...原创 2019-01-22 15:17:34 · 530 阅读 · 0 评论 -
Map in C++ Standard Template Library (STL)
Map in C++ Standard Template Library (STL)Maps are associative containers that store elements in a mapped fashion. Each element has a key value and a mapped value. No two mapped values can have same...原创 2019-01-23 10:41:06 · 232 阅读 · 0 评论 -
Set in C++ Standard Template Library (STL)
Set in C++ Standard Template Library (STL)Sets are a type of associative containers in which each element has to be unique, because the value of the element identifies it. The value of the element c...原创 2019-01-24 10:52:48 · 214 阅读 · 0 评论 -
Sorting 2D Vector in C++ | Set 2 (In descending order by row and column)
We have discussed some of the cases of sorting 2D vector in below set 1.Sorting 2D Vector in C++ | Set 1 (By row and column)More cases are discussed in this articleCase 3 : To sort a particular ...原创 2019-01-17 10:48:03 · 204 阅读 · 0 评论 -
Ways to copy a vector in C++ -- c++中复制vector的方法
In case of arrays, there is no much choice to copy an array into other, other than iterative method i.e running a loop to copy each element at respective index. But Vector classes has more than one m...原创 2019-01-15 17:03:00 · 1751 阅读 · 0 评论 -
List in C++ Standard Template Library (STL)
Lists are sequence containers that allow non-contiguous memory allocation. As compared to vector, list has slow traversal, but once a position has been found, insertion and deletion are quick. Normall...原创 2019-01-17 14:22:38 · 251 阅读 · 0 评论 -
Binary Search(二分搜索) 和Sort(排序) in C++ Standard Template Library (STL)
Binary search is a widely used searching algorithm that requires the array to be sorted before search is applied. The main idea behind this algorithm is to keep dividing the array in half (divide and ...原创 2019-01-17 11:52:38 · 384 阅读 · 0 评论 -
The C++ Standard Template Library (STL) -- C++的标准模板库
The Standard Template Library (STL) is a set of C++ template classes to provide common programming data structures and functions such as lists, stacks, arrays, etc. It is a library of container classe...原创 2019-01-17 11:36:49 · 561 阅读 · 0 评论 -
2D vector in C++ with user defined size
A 2D vector is a vector of vector. Like 2D arrays, we can declare and assign values to 2D matrix. 二维vector是由vector组成的vector,和二维数组一样,可以声明和定义二维数组。// C++ code to demonstrate 2D vector #include <io...原创 2019-01-17 11:14:38 · 351 阅读 · 0 评论 -
Sorting 2D Vector in C++ | Set 1 (By row and column)
What is a 2D Vector?A 2D vector is vector of vectors. It is an matrix implemented with the help of vectors. 二维的vector,是vector中的元素是vector,用vector实现的矩阵。// C++ code to demonstrate 2D vector #include...原创 2019-01-17 10:38:18 · 551 阅读 · 0 评论 -
头文件 string.h cstring string 区别
1.#include //不可以定义string s;可以用到strcpy等函数using namespace std;#include //可以定义string s;可以用到strcpy等函数using namesapce std; #include //不可以定义string s;可以用到strcpy等函数转载 2017-03-31 19:25:40 · 310 阅读 · 1 评论 -
c++的STL的array
#include #include using namespace std;int main(){// array arr = { 1, 2, 3, 4, 5, 6, 10, 11, 15, 78, 52, 110}; //type ,size// /***********************Member functions********************原创 2017-04-07 17:05:52 · 348 阅读 · 0 评论 -
c++的STL的deque
/**Deque is acronym for Double Ended Queue. It is a sequence container that can change it's size runtime. Container is an object that holds data of same type. Sequence containers store element原创 2017-04-07 20:13:42 · 252 阅读 · 0 评论 -
[Error] 'atoi' was not declared in this scope
在头文件添加#include原创 2016-04-18 15:08:25 · 1098 阅读 · 0 评论 -
forward_list in C++ STL
1 forward_list::front() and forward_list::empty() in C++ STLForward list in STL implements singly linked list. Introduced from C++11, forward list are useful than other containers in insertion, remo...原创 2019-01-18 09:55:49 · 315 阅读 · 0 评论 -
List in C++ | Set 2 (Some Useful Functions)
We have discussed List and some of its functions in the following article:List : Sequence ContainersSome more useful functions are discussed in this article1. emplace(position, value) :- This fu...原创 2019-01-18 09:16:29 · 166 阅读 · 0 评论 -
Vector in C++ STL c++中的stl的vector
Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. Vector eleme...原创 2019-01-15 16:49:56 · 383 阅读 · 0 评论 -
Sorting 2D Vector in C++ | Set 3 (By number of columns)
We have discussed some of the cases of sorting 2D vector in below set 1 and set 2.Sorting 2D Vector in C++ | Set 1 (By row and column)Sorting 2D Vector in C++ | Set 2 (In descending order by row and...原创 2019-01-17 10:55:56 · 191 阅读 · 0 评论 -
pair in C++ Standard Template Library (STL) c++中的stl里的pair
The pair container is a simple container defined in <utility> header consisting of two data elements or objects.pair容器在<utility>中定义,包含两个数据成员。The first element is referenced as ‘first’ an...原创 2019-01-15 09:51:30 · 286 阅读 · 0 评论 -
Multiset in C++ Standard Template Library (STL)
Multiset in C++ Standard Template Library (STL)Multisets are a type of associative containers similar to set, with an exception that multiple elements can have same values. 元素可以由相同的值。Some Basic Fu...原创 2019-01-25 11:09:52 · 203 阅读 · 0 评论 -
Multimap in C++ Standard Template Library (STL)
Multimap in C++ Standard Template Library (STL)Multimap is similar to map with an addition that multiple elements can have same keys. Rather than each element being unique, the key value and mapped ...原创 2019-01-25 10:22:40 · 207 阅读 · 0 评论 -
unordered_set in C++ STL
unordered_set is implemented using hash table where keys are hashed into indices of this hash table so it is not possible to maintain an order. All operation on unordered_set takes constant time O(1) ...原创 2019-01-24 15:34:32 · 530 阅读 · 0 评论 -
unordered_map in C++ STL
unordered_map is an associated container that stores elements formed by combination of key value and a mapped value. The key value is used to uniquely identify the element and mapped value is the cont...原创 2019-01-24 11:39:51 · 378 阅读 · 0 评论