FAQ Database Discussion Community


I want to be able to use 4 different variables in a select statement in c ++

c++,visual-c++
First off I am new to C++ and I am trying to learn it to update one of my companies legacy apps. Which is on windows xp and visual c++ 6.0 which is not fun.. any ways I have this select statement that reads my database and searches for a...

Is the author's code correct? - B. Stroustrup's PPP using C++: Chapter 7, Section 7.2 - Input & Output

c++,visual-c++
I'm learning C++ using B. Stroustrup's PPP using C++, 1st edition. This chapter 7 is an extension to chapter 6 in which a basic calculator, which takes expressions (like 1+2;) to produce output (';' is for terminating expression), is developed. (I'm using Visual Studio 2013) In section 7.2, to improve...

Error with construction, unable to find object when calling its method?

c++,visual-c++,constructor,g++,rvalue
I've created a few toy classes below. During compilation, it appears that the compiler has some problem with constructing the object, but throws the error when the object's method is called. I've tried compiling using MSVC10 and gcc 4.9 and the respective error messages are: MSVC10: error C2228: left '.get'...

link.exe returns error LNK1181: cannot open input file 'C:\Program.obj'

c++,windows,visual-c++,linker,linker-error
I'm compiling with a Batch file containing @echo off set link=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\link "%link%" external_input.obj periodic_dinger.obj flagger.obj monitor.obj main.obj libGui.lib libCore.lib libCint.lib libRIO.lib libNet.lib libHist.lib libGraf.lib libGraf3D.lib libGpad.lib libTree.lib libRint.lib libPostscript.lib libMatrix.lib libPhysics.lib libMathCore.lib libThread.lib All the objects and libraries are in the same directory, which is...

Docking with QWinWidget: Adding DockWidgetAreas to QWidgets

qt,visual-c++
I have an application utilizing QWinWidget in a Win32 window. I'd like to add DockWidgets and the associated behaviour to it. There don't seem to be any exposed APIs for adding custom DockAreas, and the latest docs are sparse beyond adding DockWidgets to a QMainWindow. Older docs imply there once...

VC++: how-to convert CString to TCHAR*

visual-c++,mfc
VC++: how-to convert CString value to TCHAR*.One method is GetBuffer(..) function. Is there any other way we can convert CString to TCHAR*.

C++ DLL does not run on different machine

c++,visual-c++,jni
I am developing a simple c++ application to generate a dll which later I am using in JNI to run native api calls, but the thing is the dll works well on the machine which I used to develop the dll but does not on the server. Both machines run...

Error while calling Select() in UDP sockets

winforms,visual-studio-2010,sockets,select,visual-c++
I am doing socket programming (UDP sockets) in Windows Form application. I want to use select(). socket() is called on button click, select() is called in different thread and socket descriptor is declared global. Below is my part of code regarding select: fd_set fds; struct timeval tv; tv.tv_sec = 1;...

Multiple Key Press handling in mfc

visual-c++,mfc
How to handle multiple key press in MFC. I have tried for few key combinations.But How to generalize for all key combination. BOOL Test::PreTranslateMessage(MSG* pMsg){ if(pMsg->message==WM_KEYDOWN ) { if(pMsg->wParam == 'C' || pMsg->wParam == 'V') { if(GetKeyState(VK_CONTROL) < 0){ } } } } ...

Buttons not getting replaced in CMFCToolbar at runtime

visual-c++,mfc,mfc-feature-pack
I am using CMFCToolbar in a CMFCDesktopAlertDialog which is contained inside a CMFCDesktopAlertWnd. Initially I create the window and insert 3 buttons. Then on some action, I want to change those buttons to 2 or 3 different buttons. I tried using CMFCToolbar::RemoveAllButtons() & then InsertButton(). However, it did not work....

Reading file made by cmd, results in 3 weird symbols

c++,file,c++11,visual-c++,cmd
Im using this piece of code to read a file to a string, and its working perfectly with files manually made in notepad, notepad++ or other text editors: std::string utils::readFile(std::string file) { std::ifstream t(file); std::string str((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>()); return str; } When I create a file via notepad (or any other...

Using C callback in C++/CLI

visual-c++,c++-cli,c-api
What I have I'm using Vimba C API, in my C++/CLI application. It's known to work since my mate has it done and running without errors. I've all the imports/include done. I'm using the API without errors, except one. The Manual Says In the manual of the API, there's some...

Why the standard of naming of C++ functions is not exist?

c++,visual-studio,visual-c++
I write the plugins for AutoCAD. If I write the managed (i.e. .net) plugins, then I can use any Visual Studio version which can work with .NET Framework version which are used by AutoCAD (it is very convenient): AutoCAD 2009 can use .NET 3.0, 3.5 AutoCAD 2010 can use .NET...

Linking error using soci 3.2.3 instead of 3.2.2

c++,visual-c++,soci
I have a project which uses soci for DB access. The project was originally developed with soci 3.2.2. Now I switched to soci 3.2.3 and get the following linker error messages: error LNK2001: unresolved external symbol "public: class soci::details::once_temp_type & __thiscall soci::details::once_temp_type::operator,(class soci::details::type_ptr<class soci::details::use_type_base> const &)" ([email protected]@[email protected]@[email protected][email protected][email protected]@[email protected]@@[email protected]@Z) error LNK2001: unresolved...

How to send enum type to Invoke (delegate) Visual C++

visual-c++,enums,delegates
I've a function to modify a PictureBox, so I need to use a delegate. My function needs an int in order to do its job, and I've created an enum in order to define the values it can have. However, when I'm invoking it, there's a problem because it cannot...

C++ How to create byte[] array from file (I don't mean reading file byte by byte)?

c++,file,visual-c++,byte
I have a problem I neither can solve on my own nor find answer anywhere. I have a file contains such a string: 01000000d08c9ddf0115d1118c7a00c04 I would like to read the file in the way, that I would do manually like that: char fromFile[] = "\x01\x00\x00\x00\xd0\x8c\x9d\xdf\x011\x5d\x11\x18\xc7\xa0\x0c\x04"; I would really appreciate any...

VC++ .net: Functionality from managed DLL is not exported

c#,c++,visual-c++,dll
I am very new to the .NET platform (coming from the JVM and having some limited C/C++ experience) and trying my first managed C++ class library. This is to serve as a bridge to a third-party DLL I got and I have to interface. I tried it with BridJ and...

Non-managed referenced code strangely, “magically” changes its state for no reason when wrapped in managed

c++,vb.net,visual-c++,c++-cli
I have a very strange problem: My unmanaged third-party library has a class, let's call it Foo which has a method bar() which returns an object of type Bar, like: Foo* foo = new Foo(); Bar bar = foo -> bar(); Now, this Bar has a method which is supposed...

In VC++, is there any way to know the export class of a dll without any header files?

c++,visual-c++,dll,export
If there'are a few export class in a C++ Dll, but I don't have the Dll shared header files. So I don't know the definition of these export class, the only thing I know is the class name. Is there any way to find these export class and use them?...

Which is better for MFC application hot key or Accelerator?

c++,windows,visual-c++,mfc,keyboard-shortcuts
We have MFC application which has around 10 image buttons to which we want to provide shortcut keys. Shortcuts will be customizable. I have implemented shortcuts (with no customization right now) with hotkeys using ON_WM_HOTKEY() message. After searching through Goolge I am little confuse. For example, this question is suggesting...

How can I use a variable in another input statement?

c++,visual-c++
I am asking the user to input an expression which will be evaluated in postfix notation. The beginning of the expression is the variable name where the answer of the evaluated expression will be stored. Ex: A 4 5 * 6 + 2 * 1 – 6 / 4 2...

Add more features to stack container

c++,visual-c++,stl
I am using default features(push, pop, top, empty, size) of stack container of STL. If I want to add more features like access an element from middle of stack. How could I do this? Thanks...

How emplace_back() works without variadic templates in Visual Studio 2012?

c++,c++11,visual-c++
Using Visual Studio 2012 with toolset v110 I can use container's emplace_back() function but can't use std::forward with variadic templates - accepting any amount of arguments. How is it done? As example, make_unique<>() won't compile: template<typename T, typename... Ts> std::unique_ptr<T> make_unique(Ts&&... params) { return std::unique_ptr<T>(new T(std::forward<Ts>(params)...)); } ...

C++ Why does this work

c++,visual-studio,visual-c++,switch-statement
I am using Microsoft Visual studio 2013 I currently have this switch statement: switch (option) { case 1: getline(cin, newname); cout << "What would you like your new username to be?\nName: "; getline(cin, newname); name = newname; cout << "\nYour username is now '" << name << "' with your...

Why does C++ allow a semicolon at the start of a line? [duplicate]

c++,c++11,visual-c++
This question already has an answer here: Why no semicolon gives errors but too many of them don't? 4 answers #include <iostream> using namespace std; int main() { ;;;;int i = 90;;;;; ; ;;;;cout<<"Hello"; return 0; } The above program compiled and ran successfully. From my understanding, the ;...

Arithmentic operator(+) operator will check both return type and passing arguments or not?

c++,c++11,visual-c++
#include<iostream> using namespace std; class B; class A { private: int a,b; public: A() { a=b=10; } void show() { cout<<"Hello of A: \n a:"<<a<<" b:"<<b; } friend A operator+( A AA ,B BB) ; friend B operator+ ( B BB,A AA); friend B operator+( A AAA ,B BB) ;...

Setting timeout to recv function

c++,sockets,visual-c++,recv
I read from socket using recv function. I have problem when no data available for reading. My programm just stops. I found that I can set timeout using select function. But looks that timeout affects select function itself and recv that goes after select still waits uncontinuously. fd_set set; struct...

Is strtok() safe to use [duplicate]

c++,c,visual-c++
This question already has an answer here: strtok function thread safety 2 answers I am reading a lot negative things about strtok(), some say it is obsolete, some say it is not thread safe, etc. So what is the truth, can I use strtok()? and is it thread safe?...

unique_ptr constructor with custom deleter is deleted

c++,visual-c++,unique-ptr
This example compiles and runs well with gcc 4.8.3: #include <memory> #include <functional> #include <iostream> int main() { auto str = new const char[6]{'h', 'e', 'l', 'l', 'o', '\0'}; std::unique_ptr<const char[], std::function<void(const char *)>> u_ptr(str, [](const char *s){ delete[] s; }); std::cout << u_ptr.get() << std::endl; } But when I...

Create string with ESC characters

c++,visual-c++
I can initialise string with escape characer like std:string s="\065" and this creates "A" character. But what if I need ASCI character = 200. std:string s="\200" not working. Why?

Visual Studio 2013 LINK : fatal error LNK1181: cannot open input file

c++,visual-studio,opencv,visual-c++,visual-studio-2013
I am using Visual Studio 2013. I'm trying to build some code given to me from my professor and I keep getting this error: LINK : fatal error LNK1181: cannot open input file 'C:\Users\manduchi\Documents\eyegaze\EyeGazeDemo..\Libraries\OpenCV\lib\opencv_core249.lib' However, on my computer opencv_core249.lib is located somewhere else. I've tried updating the linker directories to...

Why are the name repeating in my array, and how would i get a txt file to sort

c++,arrays,sorting,visual-c++
AfterI input scores and names for the test , the output creates repeating names , ex. I imput erick,derick,john,dick The output would probably read erick , derick, derick, derick I am also not sure how i would modify this program to open a txt file to sort the data? //...

Disable application taskbar icon's context menu in Windows 8.0 and 8.1

windows,winapi,visual-c++,contextmenu,windows-taskbar
In Windows 7, 8 and 8.1, when a user right-clicks on an application's taskbar icon, a context menu appears. Furthermore, a user can right-click on the application's name again (from the context menu) and another context menu appears, as shown in this image for Windows Explorer: Is there a possible...

What does the thing between “class” and the class name in VC++ mean?

c++,visual-c++,bridj
I have a third-party VC++ based DLL I want to use in a Java project, along with its header. I figured out BridJ is a good solution for this, but the header is so complex that JNAerator chokes at it and just freezes at 100% CPU, finally bailing out with...

WUSA catastrophic failure 0x8000ffff when called from system() VC++

c++,windows,visual-c++,windows-update
I'm trying to make a Windows Update uninstall program in C++, but whenever I try to call wusa, it exits on a catastrophic failure 0x80000ffff. I call the same command in a Command Prompt and it works perfectly. How do I fix this? Here is the function I use to...

Is there a Visual Studio Project Configuration Macro which defines DEBUG or RELEASE regardless of the Project Configuration Name?

visual-studio,visual-c++,visual-studio-2013,configuration,macros
I saw that its a very common thing to use the Visual Studio Macro called $(Configuration) for build file paths. For example if you create a new Visual C++ Project in Visual Studio 2013 your default Property Sheet will look something like this: The $(Configuration) Macro is the Name of...

MSVC function demangling

c++,visual-c++,name-mangling
I have next functions: namespace TEST { class TEST { int a; int b; }; } namespace UNION_TEST { union UNION_TEST { int a; int b; }; } union UNION_TEST_NEW { int a; int b; }; namespace NAMESPACE_1 { namespace NAMESPACE_2 { union UNION_NAMESPACE_2 { int a, b; }; }...

What is the most efficient way of passing a list of objects from c# to poor c++ win32 native dll?

c#,c++,.net,visual-c++
I need to create a list (array) from .net which consists of about 50 000 elements, pass it to c++ dll, operate on it and return a list (array) from c++ to .net. First option which comes to my mind, is to create a struct on both sides. Return an...

Cannot link to sublibrary/internal library/embedded library with CMake's Visual Studio generator

c++,visual-studio,visual-c++,cmake
The full error is available at AppVeyor. I create a library using CMake's add_library command, but when I try to compile another target to this library, I get silly errors like LINK : fatal error LNK1104: cannot open file '..\Debug\boost_http.lib' [C:\projects\boost-http\build\test\algorithm.vcxproj]. Other CMake generators do fine. How to properly handle...

How can i optimize my AVX implementation of dot product?

c,visual-c++,simd,avx,dot-product
I`ve tried to implement dot product of this two arrays using AVX http://stackoverflow.com/a/10459028. But my code is very slow. A and xb are arrays of doubles, n is even number. Can you help me? const int mask = 0x31; int sum =0; for (int i = 0; i < n;...

Unhandled Exception with Binary Search Tree [closed]

c++,visual-c++,tree
I have no idea what's causing it. Can you guys help me? Since last time people complained because I should only post a MCVE instead of all the source code. I'll just post what (I think) is related to the problem. It's basically a Binary Search Tree, and the unhandled...

Very first build error after installing Visual Studio 2013. fatal error LNK1561: entry point must be defined

c++,visual-c++,visual-studio-2013
I guess this is very simple actually, but since I'm newbie in C++ I'm unable to understand what I did wrong. Most of answers (like answers to this question) suggest this: project name -> Properties -> Expand Linker tab -> System -> SubSystem: and change subsystem to different types. I...

How to convert CString to long? VC++

visual-c++,mfc
How to convert CString to long in vc++. I have used atol but it is throwing error. long ldata = atol(str); Error no Suitable conversion from CString to const char*....

Linq in C++ CLI

xml,linq,visual-c++,xpath,c++-cli
I need to get details from a xml file. I wrote code in C# but not able to rewrite in C++/CLI. Code in C# class cROI { public Int16 iX { get; set; } public Int16 iY { get; set; } public Int16 iWidth { get; set; } public Int16...

How to enable user to re-entry(or) reuse the same dialog in MFC

visual-c++,mfc,dialog
I'm currently doing a FTP download using MFC. Is a very simple program which takes 2 inputs from user and click a download button in order to download from server. Everything is fine and im able to download it from. But i realized this program can only be executed once....

CInvalidArgumentException when checking class in PreTranslateMessage

c++,exception,visual-c++,mfc
The case: I'd like to make shortcuts with numpad so users can use my application fast. I implemented this in PreTranslateMessage and this worked. But the case is that I have an Edit Control where the user should enter some number. So at the time the user has focus on...

Sort function of two vector using make_pair in C++

c++,visual-studio-2012,visual-c++
I am using C++ to sort 2 vectors P and f by descending order of f. For example, I have P f 1000 3 0001 3 1100 2 1000 3 My expected output is P f 1000 3 0001 3 1000 3 1100 2 That means if it is high...

Why is a “user breakpoint” called when I run my project with imported .lib, not when code is inline?

c++,visual-c++,dll,runtime-error,breakpoints
The Situation I am writing a wrapper library for GPIB communications for setting up specific instruments according to a clients specifications to automate some of their processes. I have to use C++ and the old '98 compiler in VC++ 6.0 running on a Windows NT machine to maintain compatibility with...

How to find what headers my C++ application is using? [duplicate]

c++,visual-c++,visual-studio-2013
This question already has an answer here: list of all header files included by a C file 3 answers I'm using some open source (MIT license) project that's composed of headers only. I'm using only a small fraction of what this project has to offer, and I'd hate to...

Undeclared Identifier in separate compilation

c++,visual-c++
It's been a while since I last coded using separate compilation so I'm a bit embarrassed that I can't figure out what is causing such a rudimentary error. Here is the code in question from my "SpaceInvader.h" file: #pragma once #include "ClassDemoApp.h" #include "SpriteSheet.h" #include "Bullet.h" #include <vector> class Character{...

Does C allow casting a struct type to itself?

c,visual-c++,visual-studio-2008,struct
So we have a struct type like this: typedef struct { U64 low; U64 high; } U128; Then somewhere in the code as a result of macro expansion there is an assignment like this: *ptr = (U128)value; Where ptr is of U128*. And this causes the following error: error C2440:...

Struct attribute changed after usage

c,visual-c++
In the following example, once we access the bar attribute its value automatically changes. typedef struct { DWORD bar; } MYTYPE; void Create(LPVOID *myTypePtr) { MYTYPE myType; myType.bar = 50; *myTypePtr = &myType; } int _tmain(int argc, _TCHAR* argv[]) { DWORD foo; MYTYPE *fooPtr; Create((LPVOID)&foo); fooPtr = (MYTYPE*)foo; printf("%d\n", fooPtr->bar);...

C++ unsigned long doesn't wrap around after 4294967295

c++,visual-c++,integer,g++,long-integer
I was playing with some c++ code, and found that if I start a unsigned long with 4294967295 (its max allowed value) and add let's say 6 I MUST get 5, and it does! but the following operation of addition, and mod 255 does not give the correct answer. why...

Round decimal for a float number

c++,visual-c++,integer,cocos2d-x-3.0
in VC++ I have a float number say 1.32544354353 i.e float num=1.32544354353; I want only first 1 digit after point. i.e 1.3 (not 1.300000000). How can I get this? Please help me... If their is a solution in Cocos2dx thats better(I want this in my cocos2d-x game)

Is it possible to change Pictue Control background color istead of Changing image?

c++,visual-c++,mfc
I am trying to change color of a Picture Control box Which I added to a Dialog box in Microsoft Visual C++ environment. I did these Procedure: In Resource file-> Dialog editor I added a Picture Control box(Type=Rectangle) I had a look at this problem and tried to keep continuing...

Building in VC6, need unsigned long long

visual-c++,compiler-errors
I need to build a purchased library (with source) that was built in VC 2010. We have to build with VC6. I ran across signed and unsigned "long long". I am using "_int64" for the signed type but was unable to find anything for the unsigned type. Has anyone run...

How can i open a file in visual c++?

c++,visual-c++,fstream
I'm using visual studio and having problem opening this text file I've put it in the folder with all the source code yet i get an "No such file or directory" error. Here's my code void Game::load_map(const char *filename) { int width,height,current; std::ifstream in(filename); if(in.fail()){ std::cout << "problem opening the...

How to sync a Progress Control with a set of data which is loading in a Dialog Box in Visual C++

c++,visual-studio-2012,visual-c++,mfc
I'm trying to add a progress control in my dialogs, that will step upon every iteration of a loop until completion. I've never played around with progress controls before, so I'm totally clueless as to where I should start. I've added a progress control resource view into my dialog, but...

Visual C++ accepts One point decimal

visual-c++
I have a calculator in visual c++, and I want to press a button of point, example 1.2 point , but if the number already has a point don't accept more String^ punto; String^ dato = lblDatos->Text; bool point = false; if (lblDatos->TextLength > 0) { punto = dato +...

Changing the launch directory of executable in MSVC

c++,c,visual-c++,visual-studio-2013
My folder hierarchy looks like this: bin -> data -> blurf.xml lib -> blurb.lib src -> blah.cpp msvc -> project_name -> project_name.sln ... .... Here is my issue. This project needs to run on Linux and Windows So I need that when I build it in MSVC, the exe ends...

Zoom Bitmap Image from center in mfc

visual-c++,mfc
I am new to MFC. How to zoom Bitmap image from center. In my code image is zooming from top left corner. But image should zoom from center in scrollbar.. void CRightUp::ImageDraw(int sHeight,int sWidth){ CDC *screenDC = GetDC(); CDC mDC; mDC.CreateCompatibleDC(screenDC); CBitmap bitmap; bitmap.CreateCompatibleBitmap(screenDC, sWidth, sHeight); CBitmap *pob = mDC.SelectObject(&bitmap);...

how to print to screen only once in the end of a multiple for tests

c++,c++11,visual-c++
Well the header of this question isn't really clear but I can't [at this point of time] think of a better explanation than the real problem itself which is: I have a method of a class let it be denoted as max_val[the name of the method not the class]. max_val...

How to handle an event message while using chrome embedded framework (CEF)?

c++,winapi,visual-c++,chromium-embedded
I'm using Chromium Embedded Framework(CEF) to develop a windows desktop application(using C++/Win32, No MFC). I have used the sample "cefsimple" project and extended on it till now. I have added "Handlers" for keyboard events etc. Everything works fine till now, I can get the handle of the browser window and...

Managing code with using #define

c++,visual-c++
I have several source and header files that contains code that should be compiled dependent on the same option. That option might be set with #define myOption To be visible this option in all my files I need to put it in place where all files could see it. I...

Use C++ DLL library project in C++ /CLR project

c++,visual-c++,dll,clr
I'm trying to use a unmanaged C++ DLL library project in a C++ /CLR managed wrapper project, but because the unmanaged project uses <thread> the managed project won't build: error C1189: #error : <thread> is not supported when compiling with /clr or /clr:pure. to be clear: the managed project itself...

Compile-time error while using custom C++ header file - “std_lib_facilities.h”

c++,visual-studio,visual-c++
I'm new to C++ and I'm learning using this book - Programming Principles & Practice using C++ by Bjarne Stroustrup, 1st edition. The author uses a header file std_lib_facilities.h (here) for every program - examples, drill or exercises. I'm trying to solve this question 13 from chapter 4 - Create...

Macro to push arguments onto stack

visual-c++,assembly,macros
I've been working on a fun little project to mess around with how functions are called and I need a macro to push arguments as it'll be quite time consuming to push the arguments manually for every instance of this obfuscated call. This is my code so far: #define pushargs(...)...

C++, how to call functions when reading their ID number from a Mysql table?

c++,visual-c++,design
I have a Mysql table that I am using as a list of different calculations that needs to be done. Each line in the table has a column of type INT that has the number of the function that needs to be called. e.g. line 6, data, (function) 1. I...

How to zoom in/out an image on clicking zoom in/out button in SDI?

visual-c++,mfc
I am new to VC++. How to zoom in/out an image on clicking zoom in/out button in SDI.

msvc++ doesn't see overloaded operator<<

c++11,visual-c++
I'm porting a piece of code which was written for Linux and compiled with gcc v4.8.2 (using -std=c++11) to Windows. Part of it is an overloaded operator<< which MSVC++ 2013 doesn't agree with. A condensed example is below. We've defined a custom stream class which supports the standard stream manipulator...

template programming: ambiguous call to overloaded function

c++,templates,c++11,visual-c++
I am implementing a sorting algorithm as personal training (no homework!). I have the following code (excluding imports etc.): template<class RandomIt, class Compare> void sort(RandomIt first, RandomIt last, Compare comp) { /* actual sorting code is here */ } template<class RandomIt> void sort(RandomIt first, RandomIt last) { std::function<bool(decltype(*first), decltype(*last))> comp...

How to handle Key press ctrl+shift+A in sdi mfc

visual-c++,mfc
I am new to vc++.How to handle Key press ctrl+shift+A in sdi mfc. For ctrl + A code is working fine. case _T('A'): if(GetKeyState(VK_CONTROL) & 0x8000){ MessageBox(_T("Key Ctrl+A is pressed")); } else if((GetKeyState(VK_CONTROL) & 0x8000)&&(GetKeyState(VK_SHIFT) & 0x8000)){ MessageBox(_T("Key Ctrl+Shift+A is pressed")); } break; ...

Cannot link Boost to CMake-based project on VS2015 RC

c++,visual-studio,visual-c++,boost,cmake
It gives the error: LINK : fatal error LNK1104: cannot open file 'boost_unit_test_framework-vc140-mt-gd-1_58.lib' [C:\projects\boost-http\build\algorithm.vcxproj] You can see the full error at AppVeyor. The build script (CMakeLists.txt and how cmake is invoked) can be found on the project repository. I've tried a lot, but nothing seems to help. Documentation doesn't help...

Should Resource IDs be unique in my shared MFC DLLs

visual-c++,mfc
Example: The first MFC DLL has a menu ID_MENU_FOO with ID value 4711 in resource.h. The second MFC DLL also has another menu ID_MENU_BAR with the same ID value 4711. The Application (exe) uses both DLLs and calls LoadMenu. If I want to verify the desired menu to be loaded,...

UCHAR * to CString conversion and CString to UCHAR * to conversion in vc++

visual-c++,mfc
I am new to vc++. How to convert UCHAR * value to CStringand CString to UCHAR * CString str; UCHAR * pBuffer; ......Memmory allocation.. str.format(_T("%d"),pBuffer); But its not working. Second data may be string or int so how to do conversion in proper way....

MFC: member variable vs resource id of control

visual-c++,mfc
I am new to vc++. I want to know which is proper and efficient way of handling controls by using member variable or resource id of controls. m_Name.SetWindowTextW(_T("xyz")); or SetDlgItemText(IDC_EDIT2,_T("xyz")); or CWnd* cwd = GetDlgItem(IDC_EDIT2); cwd->SetWindowTextW(_T("xyz")); ...

Program hangs in Visual Studio debugger

c++,visual-studio,c++11,visual-c++
Some background: I am trying to track a bug which is causing me major headaches. After many dead ends (see this question) I finally ended up with this code: #include <thread> #include <vector> #include <iosfwd> #include <sstream> #include <string> #include <windows.h> int main() { SRWLOCK srwl; InitializeSRWLock(&srwl); for(size_t i=0;i<1000;++i) {...

C++ Strings Matching Returning False

c++,visual-c++
I'm working on my C++ assignment. I'm having an issue with string comparison. I'm comparing two apparently identical strings using == operating but the condition returns false. The debugger also shows that both strings (stored in different variables) are identical. I must be missing something. Here is my code: void...

MFC: How to fix row and column repetition in CListctrl

visual-c++,mfc
I am new to vc++.How to fix row and column repetition in CListctrl in MFC. int nItem = 0; m_list.InsertColumn(0, _T("Name"), LVCFMT_LEFT, 100); m_list.InsertColumn(1, _T("Area km\262"), LVCFMT_RIGHT, 80); m_list.InsertColumn(2, _T("Population"), LVCFMT_RIGHT, 100); m_list.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); ModifyStyle(0, LVS_REPORT); nItem = m_list.InsertItem(0, _T("Libya"), 8); m_list.SetItemText(nItem, 1, _T("1,759,540")); m_list.SetItemText(nItem, 2, _T("5,499,074")); nItem...

How to initialize a String^ *

c++,visual-c++,c++-cli
I'm using VS2010, a Visual C++ project. I've declared my var to store some options to be shown in a control: System::String^ * operaciones; Now, in my void InitializeComponent(void), I'm trying to load to this var the options I want to load later. I tried several ways and no one...

CMFCTabCtrl get handle of tabs and their childs

visual-c++,mfc
I have a properly initialized object of CMFCTabCtrl in my application. I have added some tabs to it by m_oMTC.AddTab(pTab, Name, -1, FALSE); now I want to iterate over over all tabs in m_oMTC, get tabs handle and check some of it's child item. How can i do this? I...

Linker error compiling DX10 program in Visual Studio 2015

visual-studio,visual-c++,linker,directx
I am trying to compile old program which works with DirectX 10. Full list of libraries used: #pragma comment(lib, "d3d10.lib") #pragma comment(lib, "d3dx10.lib") #pragma comment(lib, "dxgi.lib") #pragma comment(lib, "dxerr.lib") #pragma comment( lib, "dxguid.lib" ) Linker error: dxerr.lib(dxerrw.obj) : error LNK2019: unresolved external symbol _vsnwprintf referenced in function "long __cdecl StringVPrintfWorkerW(unsigned...

Template specialization static member in different namespace

c++,templates,c++11,visual-c++,gcc
There is a template class in a namespace namespace N { template <typename T> class Foo { static const T bar; }; } And a specialization in a different namespace: namespace O { typedef N::Foo<int> Baz; template<> const int Baz::bar = 1; } This code compiles with gcc (4.9.2) but...

What does the * do with that class?

c++,visual-c++
It might be a "dumb" question but i dont know what * do in that code. ClassA* classa; ClassA is a class, so what does the * actually do with a class? and how this ?operator? called?...

Adding to struct from a loop (c++)

c++,visual-c++,for-loop,struct
So I'm using the code below but am getting an error when trying to call the text from a line in the struct. struct lines { LPCSTR text; int mInt; }; for (int n = 0; n < lineCount - 1; ++n) { vector<lines> sub; lines lineData; LPCSTR onlinePlayerName =...

Vector iterator not incremental

c++,qt,visual-c++
I'm trying to implement a simple menu application in Qt and I got to the point where I have to make a filter button. Qt is giving an error and I don't know how to interpret it. It could come only from these 2 functions. I'll post a photo of...

Difference between vector and list [duplicate]

c++,visual-studio-2012,visual-c++
This question already has an answer here: vector vs. list in STL 11 answers I'm learning c++ language and I trying to find out what is the difference between vector's and list's. I am using visual studio tool for coding. Can someone explain what is the difference? ...

Why this causing Heap corruption?

c++,visual-c++
Why this piece of code causing Heap corruption when trying to delete[] fullname variable? #include <iostream> #include <cstring> #include "stdafx.h" using namespace std; int main() { const int size = 255; char* firstname = new char[size]; char* lastname = new char[size]; cin.getline(firstname, size, '\n'); cin.getline(lastname, size, '\n'); int fullnamesize =...

Google Chrome - How to compile Google Chrome in Windows?

google-chrome,visual-c++,windows-8.1,ninja
Documentation mentioned to compile i have to follow this instruction for Windows: http://www.chromium.org/developers/how-tos/build-instructions-windows So i did all the steps, but the following is failing how can i resolve it? C:\tpt\depot_tools>mkdir out\Debug C:\tpt\depot_tools>ninja -C out\Debug chrome ninja: error: loading 'build.ninja': Het systeem kan het opgegeven bestand niet vinden. ninja: Entering directory...

How to use namespace System; in MFC application with VC++

c++,sql,visual-c++,mfc,namespaces
help me,am new, I want to use some features(i don't know the specific word to use) present in System namespace, but when i try to add it to my project by "using namespace System",i want this to use SQLCLIENT ,i saw below link giving answer but dont have a clue...

Why a breakpoint jumps in my C++ code?

c++,visual-studio,visual-c++
MS Visual Studio 2013. I see my breakpoint is moving in runtime (C++ code). I had never such behaviour in my C# code, why I get this in C++? How can I solve it? #include <Windows.h> int main(){ HANDLE hFile = ::CreateFile(TEXT(""), 0, 0, NULL, OPEN_EXISTING, 0, NULL); if (INVALID_HANDLE_VALUE...

Windows Service not starting on cold boot

.net,windows,visual-c++,windows-services
Windows isn't ALWAYS starting my service on a cold boot, most of the time it does, but every now and again it fails to start with a 'Timeout was reached' error in the system log. I added a line to dump the time at the very start of the service...

Static Class Template member initialization

templates,c++11,visual-c++,static,msvc12
I have an issue when trying to initialize static members of a static class template. Basically, what I thought this approach would be useful for: I have a lot of objects, which are of course all of the same Base type but they have differing object types. I just want...

VC++/CLI: How to prevent an unmanaged object from being destroyed when it goes out of scope?

c++,.net,visual-c++,c++-cli,interop
I have a third-party unmanaged C++ library which has two classes, let's call them ClassA and ClassB. ClassA has a method, let's call it getTheB(), which returns an instance of ClassB - it does not return a pointer to the instance, but the instance itself. I now wrote a managed...

How to check/compare whether four variables are same or different using conditional statement in C# or C++

c#,linq,sorting,visual-c++,conditional-statements
I have 4 variables having values as a=50;b=100;c=500;d=1000; If all the values are the same then count =1,else if any two values are same then count = 3,if any three values are same then count = 2. I can easily find out if all values are the same but in...

How to use GetFileTime in c++

c++,visual-c++
I am trying to get the last write time of a file in VC++ but I think I am writing the file handle in a wrong way can you help me find the right way to write the file handle for example my directory is "D:/start.txt" here is my code...

How to implement an interface defined in VB.net in VC++/CLI?

c++,vb.net,visual-c++
I have a VB.net based interface like this: Namespace Foo Public Interface Bar ReadOnly Property Quuxes as Quux() End Interface End Namespace I now want to implement this in VC++/CLI (because I need to interface functions from an unmanaged third-party DLL), however I cannot figure out the correct syntax how...

Dynamic Memory Deletion in vc++

visual-c++,mfc
I am using _aligned_malloc in my code. But it is throwing error error as shown in image. CString sBuffer = _T("Hello"); TCHAR* pBuffer; pBuffer = (TCHAR *)_aligned_malloc(1024, 16); if (pBuffer == NULL) { ...............Error .. msg } pBuffer = sBuffer.GetBuffer(sBuffer.GetLength()); .................................................. ......................................................... sBuffer.ReleaseBuffer(sBuffer.GetLength()); if (pBuffer != NULL) { _aligned_free(pBuffer); }...

Is it possible to override IEnumerable in VC++/CLI?

.net,visual-c++
I have an interface which returns an IEnumerable, and I want to implement this in VC++/CLI because the data comes from a third-party unmanaged DLL. So far I have: public ref class MyEnumerable : IEnumerable<SomeType^> { public: virtual IEnumerator<SomeType^>^ GetEnumerator(); } But the compiler complains with C2393: "Covariant returns types...

std::map for small sparse collections

c++,visual-studio-2010,visual-c++
Given a struct MyData, of which many instances exist (I'd say several millions at most), for each instance I need to store a member which may contain values for up to 8 keys. The key will always be an int ranged 0-7, and the values will always be a 3D...