每次我想编译我的Visual Studio项目时,我都会收到MSVCP120d.dll缺失的消息.谷歌无法帮助我.我已经安装了一些可再发行组件,但它们没有帮助.我也发现了这个:
Msvcp120d.dll C++运行时的调试版本.不允许再分配.
http://msdn.microsoft.com/en-us/library/windows/hardware/dn448963(v=vs.85).aspx
CMake文档说明命令文件GLOB:
我们不建议使用GLOB从源树中收集源文件列表.如果在添加或删除源时没有更改CMakeLists.txt文件,则生成的构建系统无法知道何时请求CMake重新生成.
网络中的几个讨论线程第二个是通配源文件是邪恶的.
但是,为了使构建系统知道已添加或删除了一个源,这就足够了
touch CMakeLists.txt
Run Code Online (Sandbox Code Playgroud)
对?
然后,这比编辑CMakeLists.txt插入或删除源文件名更省力.也难以记住.所以我认为没有任何充分理由提出反对意见file GLOB.
这个论点有什么问题?
为什么编译和链接的可执行文件包含源代码中包含的头文件路径?我正在使用wxWidgets库并使用Visual Studio 2013和gcc进行编译.这些头文件用于什么?如果它是编译器选项,我如何禁用它以避免这种情况?
构建配置:发布,静态链接.

我的CMakeFiles.txt看起来像这样:
cmake_minimum_required ( VERSION 2.6 )
# Set warnings on and enable debugging
SET( CMAKE_C_FLAGS "-Wall -q" )
include(FindBoost)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package( Boost 1.57.0 COMPONENTS system filesystem REQUIRED )
if( Boost_FOUND )
message( STATUS "Boost found!" )
include_directories(${Boost_INCLUDE_DIRS})
add_executable(foo main.cpp)
# Needed for asio
if(WIN32)
target_link_libraries(foo wsock32 ws2_32)
endif()
target_link_libraries(foo ${Boost_LIBRARIES})
endif()
Run Code Online (Sandbox Code Playgroud)
我为Visual Studio 2013 64位渲染项目:
cmake -G "Visual Studio 12 Win64" -DBOOST_LIBRARYDIR=D:\Development\Tools\boost_1_57_0\stage\x64\lib ..\KServer
Run Code Online (Sandbox Code Playgroud)
输出是:
-- The C compiler identification is MSVC 18.0.31101.0
-- The CXX …Run Code Online (Sandbox Code Playgroud) 我知道有一些关于如何将msvcr120.dll/msvcp120.dll包含到项目中的问题.
但我想放弃这种依赖.我在Visual Studio 2013中的Release版本中编译程序.我不依赖于任何特定于VS的命令(#pragma等)或预编译的头文件等.
我想将它编译为单个版本.exe并将其提供给用户而不要求他为VS安装VC++ Redistributes(用户将使用Windows 7,Windows 8,也许是Windows XP).
那可能吗?如果是这样,怎么样?
经过一些研究后我发现,Qt 5现在提供了一个所谓的Fusion主题,这个主题在他们的一篇博文中被描述.我真的很喜欢你在上一张图片中可以看到的黑色配置的主题,我想在我的应用程序中使用它,但似乎这个配色方案是由Unity/Gnome3(看起来像一个Ubuntu窗口)强制所以我是渴望知道是否有任何可用的样式表或变通方法将这个黑暗版本的主题应用于应用程序.
我有以下问题.在成功编译之后,如果我在仅更改其中一个.h文件中的某些内容后再次编译它,则计算机会说:
make:没有什么可以为'all'做的.
即使我只修改了.h文件,我是否可以强制编译器再次编译?
我已经按照我认为正确的方式设置了程序和头文件,但我不断收到标题中提到的错误。
我曾尝试寻找此问题的修复方法,其中大多数只是添加“;” 在头文件中的类定义之后。我已经尝试了几乎所有我能找到的修复方法,但结果相同。
这是标记错误的主程序:
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include "computeGross.h"
#include "computeInsurance.h"
#include "Employee.h" /*<-----------------This is where the error flags*/
using namespace std;
int main()
{ }
Run Code Online (Sandbox Code Playgroud)
这是错误标记的头文件:
#ifndef EMPLOYEE_H
#define EMPLOYEE_H
#include <string>
using namespace std;
struct Employee
{
string name;
double rate;
double hours;
double insurance;
double social;
double stateTax;
double fedTax;
double netPay;
double grossPay;
};
#endif
Run Code Online (Sandbox Code Playgroud) 抱歉,如果之前有人问过这个问题,但我没有得到之前给出的答案。我是 VS Code 新手,了解一些 C++ 编码。我尝试了 windows/mingw 的教程:\n https://code.visualstudio.com/docs/cpp/config-mingw#_step-through-the-code \n 并完成了到目前为止的所有操作。示例代码已构建,我现在想进行调试,但在调试时单步执行应用程序时,我的变量视图显示了不同的内容。(见附图)\n
\n该单词应包含任何字符串,并且 msg 应显示不同的内容。不过,我的自制手表显示正确。这是怎么回事?我按照教程中的方式做了所有事情。
另外:终端选项卡不会从 cout 输出消息,但我在调试控制台中看到它。(参见“设置手表”章节上方教程中的图片)
\nlaunch.json 是:
\n{\n // Use IntelliSense to learn about possible attributes.\n // Hover to view descriptions of existing attributes.\n // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n "version": "0.2.0",\n "configurations": [\n \n\n {\n "name": "g++.exe - Aktive Datei erstellen und debuggen",\n "type": "cppdbg",\n "request": "launch",\n "program": "${fileDirname}\\\\${fileBasenameNoExtension}.exe",\n "args": [],\n "stopAtEntry": true,\n "cwd": "${workspaceFolder}",\n "environment": [],\n "externalConsole": false,\n "MIMode": "gdb",\n "miDebuggerPath": "C:\\\\MinGW\\\\bin\\\\gdb.exe",\n "setupCommands": …Run Code Online (Sandbox Code Playgroud) 我想使用共享内存技术在进程之间共享数据。我可以分别在 Windows 和 WSL(Linux 的 Windows 子系统)上使用 boost 库来做到这一点。两者都很好用。我的工作是让这些脚本在 1 个进程在 Windows 上运行,1 个进程在 WSL Linux 上运行时工作。他们在同一台机器上运行。
发件人脚本
#include <chrono>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <cstring>
#include <iostream>
#include <thread>
using namespace boost::interprocess;
int main(int argc, char* argv[])
{
//Remove shared memory on construction and destruction
struct shm_remove
{
shm_remove() { shared_memory_object::remove("sharedmem"); }
~shm_remove() { shared_memory_object::remove("sharedmem"); }
} remover;
//Create a shared memory object.
shared_memory_object shm(create_only, "sharedmem", read_write);
//Set size
shm.truncate(1000);
//Map the whole shared memory in this process
mapped_region …Run Code Online (Sandbox Code Playgroud) c++ ×8
boost ×2
cmake ×2
c ×1
compilation ×1
dll ×1
glob ×1
header-files ×1
ipc ×1
makefile ×1
mingw-w64 ×1
qt ×1
qt5 ×1
stylesheet ×1
themes ×1
visual-c++ ×1
windows-subsystem-for-linux ×1
wsl-2 ×1
wxwidgets ×1