How do I build an import library (.lib) AND a DLL in Visual C++?

I want to have a single Visual Studio project that builds a DLL file and an import library (.lib) file. (An import library is a statically-linked library that takes care of loading that DLL file in other projects that use it). So I went to Visual Studio C++ 2008 Express Edition, created a New Project of type Class Library, and set the "Configuration Type" to be "Dyanamic Library

如何在Visual C ++中构建导入库(.lib)和DLL?

我想拥有一个构建DLL文件和导入库(.lib)文件的Visual Studio项目。 (导入库是一个静态链接库,负责在使用它的其他项目中加载该DLL文件)。 所以我去了Visual Studio C ++ 2008 Express Edition,创建了一个类型为Class Library的新项目,并将“Configuration Type”设置为“Dyanamic Library(.dll)”。 但是当我构建解决方案时,我看到的唯一相关的输出文件是一个DLL文件; 我没有看到任何LIB文件正在生成。 我查看了项目

Why have header files and .cpp files?

为什么C ++有头文件和.cpp文件? Well, the main reason would be for separating the interface from the implementation. The header declares "what" a class (or whatever is being implemented) will do, while the cpp file defines "how" it will perform those features. This reduces dependencies so that code that uses the header doesn't necessarily need to know all the details of

为什么有头文件和.cpp文件?

为什么C ++有头文件和.cpp文件? 那么,主要原因是将接口与实现分开。 头文件声明了“什么”类(或正在实现的任何内容)将会执行,而cpp文件定义了它将如何执行这些功能。 这减少了依赖性,以便使用头的代码不一定需要知道实现的所有细节和任何其他只需要的类/头。 这将减少编译时间以及实现中的某些内容所需的重新编译量。 这并不完美,你通常会使用像Pimpl Idiom这样的技术来正确分离界面和实现,但这是一个好的开始。 C

Understanding of Managed C++

I am having a trouble understanding how does managed C++ work and compile. In .NET Framework, you can develop code in C#/VB/F#/..etc. and all of these languages will be compiled to the same Common Intermediate Language (CIL) which is similar to Java Bytecode. Theoretically, the CIL can be mounted on any platform (Mono made it practical). On Windows, CLR compiles the CIL to native code Just-I

了解Managed C ++

我在理解托管C ++如何工作和编译时遇到困难。 在.NET Framework中,您可以使用C#/ VB / F#/ ..等开发代码。 并且所有这些语言都将被编译为与Java字节码相似的通用中间语言(CIL)。 从理论上讲,CIL可以安装在任何平台上(Mono使其具有实用性)。 在Windows上,CLR将CIL编译为本地代码Just-In-Time(JIT),并且一切运行顺利并且顺利。 现在,Managed C ++如何编译? 它是否编译为CIL代码并等待CLR使用JIT运行它? 我

Is Boost/STL slow with regard to high performance computing?

Apologies for another internet forum quote, but I thought this was interesting and wanted to ask: C++ is faster if you chuck the "safety" features of programming languages and avoid things like STL, and Boost. In raw bytes to bytes C++ is faster, but then again so is C. The moment you add the baggage of STL, and Boost you are slower than well written C# code. The advantage that th

Boost / STL在高性能计算方面是否缓慢?

道歉为另一个互联网论坛报价,但我认为这很有趣,并想问: 如果您查看编程语言的“安全”特性并避免诸如STL和Boost之类的事情,C ++就会更快。 在以字节为单位的字节中,C ++速度更快,但C也是如此。 当你添加STL的行李时,Boost你比编写好的C#代码慢。 C#JIT和Java jit具有的优点是这些安全功能已经过优化。 C ++安全特性依赖于编译器的优化。 因此,如果你不注意STL和Boost代码,你将会有一个应用程序的跛脚鸭。 我

How do YOU reduce compile time, and linking time for Visual C++ projects (native C++)?

How do YOU reduce compile time, and linking time for VC++ projects (native C++)? Please specify if each suggestion applies to debug, release, or both. It may sound obvious to you, but we try to use forward declarations as much as possible, even if it requires to write out long namespace names the type(s) is/are in: // Forward declaration stuff namespace plotter { namespace logic { class Plot

您如何减少编译时间以及Visual C ++项目(本机C ++)的链接时间?

您如何减少编译时间以及VC ++项目(本机C ++)的链接时间? 请指定每个建议是否适用于调试,发布或两者。 这听起来很明显,但我们尽可能地使用前向声明,即使它需要写出类型为/的长名称空间名称: // Forward declaration stuff namespace plotter { namespace logic { class Plotter; } } // Real stuff namespace plotter { namespace samples { class Window { logic::Plotter * mPlotter;

C++ programming style

I'm an old (but not too old) Java programmer, that decided to learn C++. But I have seen that much of C++ programming style, is... well, just damn ugly! All that stuff of putting the class definition in a header file, and the methods in a different source file- Calling functions out of nowhere, instead of using methods inside classes . All that just seems... wrong! So finally, is there

C ++编程风格

我是一个老的(但不太老)Java程序员,他决定学习C ++。 但是我已经看到了很多C ++编程风格,好吧,只是该死的丑! 所有这些将类定义放在头文件中的方法,以及将方法放在不同的源文件中 - 调用函数无处不在,而不是在类中使用方法。 所有这些似乎......错了! 那么最后,我是否有理由继续对OOP进行这次大屠杀,以及编程中的任何好的和正义的事情,还是我可以忽略那些老式的C ++约定,并使用我的良好Java编程风格? 顺便

Visual studio 2012 slow compile time

I have an extremely small project in visual studio 2012 (only 50 lines of code). I only have one source file ( main.cpp ). But yet it takes about 20 seconds or more to compile! How am I supposed to speed it up? When I use C# the compile times are fast but when it comes to C++ it's super slow. As for my minimal computer specs, I have an i5 processor, 4gb of ram and it is a quad core. It

Visual Studio 2012编译时间很慢

我在visual studio 2012中有一个非常小的项目(只有50行代码)。 我只有一个源文件( main.cpp )。 但编译需要大约20秒或更长的时间! 我应该如何加快速度? 当我使用C#时,编译时间很快,但对于C ++来说,它速度很慢。 至于我最小的电脑规格,我有一个i5处理器,4gb ram,它是一个四核。 编译长度只有50行的东西不应该花这么长时间。 我该怎么办? 我的代码: #include<iostream> using namespace std;

Why do compilations take so long?

I am designing a programming language and one of the problems i was thinking was why do programming languages take long to compile. Assumed c++ takes a long time because it needs to parse and compile a header everytime it compiles a file. But i -heard- precompiled headers take as long? i suspect c++ is not the only language that has this problem. 一个C ++特有的问题使其变得非常慢,因为与几乎任

为什么编辑需要这么长时间?

我正在设计一种编程语言,我在想的一个问题是为什么编程语言花费很长时间来编译。 假定c ++需要很长时间,因为每次编译文件时都需要解析和编译头文件。 但是我 - heard-预编译头文件需要很长时间? 我怀疑c ++不是唯一有这个问题的语言。 一个C ++特有的问题使其变得非常慢,因为与几乎任何其他语言不同,您无法独立于语义分析来解析它。 编译是一个复杂的过程,涉及到很多步骤: 扫描/乐星 解析 中间代码生成 可

C/C++ BLE read/write example with Bluez

I am starting to build up a simple BLE network with a microcontroller and a raspberry pi (tardis BLE dongle). As a starting point, I am looking for a simple C or C++ example to read/write a BLE device, similar to what I am able to do over the command line. The examples I have found so far are quite complicated. As a BLE beginner I need some very simple examples to build from before moving forw

C / C ++ BLE读/写示例与Bluez

我开始建立一个带有微控制器和覆盆子pi(tardis BLE dongle)的简单BLE网络。 作为一个起点,我正在寻找一个简单的C或C ++示例来读取/写入BLE设备,类似于我能够通过命令行执行的操作。 我迄今发现的例子非常复杂。 作为一名BLE初学者,我需要一些非常简单的示例,然后再进行更复杂的设计。 对于BLE设备名称的硬编码,我可以像在下面的gattool示例中那样对其进行硬编码。 以下是我目前如何使用Bluez的命令行选项。 从命

How to use boost::asio with Linux GPIOs

I have a single-threaded Linux application using boost::asio for asynchronous input/output. Now I need to extend this application to read in GPIO inputs on /sys/class/gpio/gpioXX/value . It is possible to do that with boost::asio::posix::stream_descriptor on edge-triggered GPIO inputs? I configured the GPIO input like follows: echo XX >/sys/class/gpio/export echo in >/sys/class/gpio/g

如何在Linux GPIO上使用boost :: asio

我有一个使用boost :: asio进行异步输入/输出的单线程Linux应用程序。 现在我需要扩展此应用程序以读取/sys/class/gpio/gpioXX/value中的GPIO输入。 在边缘触发的GPIO输入上使用boost :: asio :: posix :: stream_descriptor可以做到这一点? 我如下配置GPIO输入: echo XX >/sys/class/gpio/export echo in >/sys/class/gpio/gpioXX/direction echo both >/sys/class/gpio/gpioXX/edge 我设法编写一个基于epoll