Questions tagged [visual-c++]

1

votes
1

answer
568

Views

“error: Unable to find vcvarsall.bat” when compiling Cython code

As suggested here, I have succesfully installed Microsoft Visual C++ Compiler for Python 2.7 to compile some Cython code, but: from distutils.core import setup from Cython.Build import cythonize setup(ext_modules = cythonize("module1.pyx")) still produces: error: Unable to find vcvarsall.bat How to...
Basj
1

votes
1

answer
52

Views

libsvm compiled with AVX vs no AVX

I compiled a libsvm benchmarking app which does svm_predict() 100 times on the same image using the same model. The libsvm is compiled statically (MSVC 2017) by directly including svm.cpp and svm.h in my project. EDIT: adding benchmark details for (int i = 0; i < counter; i++) { std::chrono::high_r...
user1934513
-1

votes
0

answer
39

Views

Can a list iterator not be incremented?

I am trying to run this project by i am getting the exception list iterator not incrementable. The debugger is showing the exception on the second for loop in Collision.cpp. I have also included the header file Collision.h. Any suggestions? Collision.cpp void Collision::DoCollisions(Game *game) { f...
Knevagi
1

votes
1

answer
332

Views

Inline functions and calling conventions

Is there a point in specifying calling convention for an inline function? For example, I am writing SIMD math library, where it is recommended to use __vectorcall, but all of my functions are inline. In some articles I have seen people inlining all function and still saying, that you need to compile...
M. Kolesnik
1

votes
1

answer
74

Views

Is it possible to tell clang which registers to use for certain parts of the code without using assembly

I'm working on an project that requires it to work on both Linux and Windows. However, there are portions of the code that don't work on Linux due to differing registers under clang and msvc. Is there a way to either make the register use consistent or request that clang use a specific register duri...
Christian Hawley
1

votes
1

answer
4.1k

Views

Constructing a std::thread with a function

This works: std::thread t = std::thread(printf, "%d", 1); This doesn't work: t2 = std::thread(my_thread_func , std::ref(context)); OR std::thread t1 = std::thread(my_thread_func , context_add); my_thread_func definition : int my_thread_func(long long *context_add) context is some struct .. and I'm...
code muncher
0

votes
0

answer
4

Views

What is the names of controls seen in MS-Office Task Pane?

I'm thinking of developing my own Excel addin with VTSO or native COM addin. Does anyone know what is the names of controls seen in task panes in MS-Office, like seen in attachment? I thought it is CMFCTasksPane, but it turns out different.
Pengin
0

votes
0

answer
11

Views

MSVC compiler intrinsic for launching a software interrupt

Is there a compiler intrinsic for x86 software interrupt instructions other than 0x2C in MSVC2017 (x64)? The intrinsic for int 0x2C is __int2c().
PhantomR
1

votes
2

answer
366

Views

Compiler generated destructors and warnings in GCC and MSVC

I'm working on clearing some warnings that show up on both GCC and MSVC when elevated warnings are in use. I'm catching a "class has virtual functions, but destructor is not virtual instances of this class may not be destructed correctly" under MSVC. I get a similar warning under GCC and Clang when...
jww
1

votes
0

answer
12

Views

Unknown C++ exception on operator new under MSVC

I'm facing an unknown exception thrown after I call the new operator. The new operator is called after a long processing time (10h) to store output results. I created a MWE with the code below put into a for loop, but it won't reproduce this error because if I create a for loop around the snippet I...
manatttta
5

votes
3

answer
144

Views

Type punning with (float&)int works, (float const&)int converts like (float)int instead?

VS2019, Release, x86. template float get() const { int f = _mm_extract_ps(fmm, i); return (float const&)f; } When use return (float&)f; compiler uses extractps m32, ... movss xmm0, m32 .correct result When use return (float const&)f; compiler uses extractps eax, ... movd xmm0, eax .wrong result The...
truthfinder
0

votes
0

answer
2

Views

Splitter to resize controls on CFormView/CPropertyPage

I am looking for a solution to resize a controls on the CFormView or CPropertyPage, something like a CSplitterWnd but can be used for resizing anchored controls. In Delphi i could use splitter control that does the work, but in MFC world it is Not so easy. What do you use in your projects? Hard to b...
Adam
1

votes
1

answer
57

Views

Is xmm8 register value preserved across calls?

My Windows program compiled using Visual Studio 2017 does the following: calls a routine that has a default argument with value 35.05. initializes the Java Virtual Machine through the C interface calls the routine again that has the default argument with value 35.05. In the first call, the default a...
Dula
1

votes
1

answer
38

Views

How to catch an exception when opening a file with CFileDialog fails

I need to catch an exception when the file or files I am going to open is/are being in use or opened by other processes or applications. I am using MFC's CFileDialog's DoModal to open a list of selected files. However, when I click Open after selecting a file in the Open File Dialog, a small popup...
Ostrich Groomer
1

votes
4

answer
1.8k

Views

Using Regular Expression in VC++

I am finding Email ids in mu project, where I am preprocessing the input using some Regular Expression. RegExpPhone6.RegComp("[\[\{\(][ -]?[s][h][i][f][t][ -]?[+-][2][ -]?[\]\}\)]"); Here while I am compiling i am getting a warning msg like Warning 39 warning C4129: ')' : unrecognized character...
1

votes
1

answer
549

Views

Win 32 API in Qt

I have a program written using MFC to communicate with a device over the Ethernet. I need to rewrite it and convert it to Qt. The MFC program uses Win API functions like CreateFile, ReadFile (to get network packet) and DeviceIOControl (to talk to the protocol used to facilitate communication) Can I...
Gumbly jr.
1

votes
2

answer
95

Views

how to get rid of lambda syntax

I need to make those function in the "normal" syntax. how do i change it? template typename const Container Schedule::getAllCourses( ) const { Container newone; std::for_each(courses.begin(), courses.end(), [&newone](Course *c) {Course* nc = new Course(c->getName(),c->getNumber(), c->getFaculty())...
user144555
0

votes
0

answer
15

Views

Question on atomic spin lock and std::this_thread::yield()

I've been trying to implement C++ a thread pool with STL that takes in tasks in queues and dispatch the tasks to the threads for execution. The queue uses an atomic spin-lock when pushing and popping, and everything seemed to work well with the following code: void push(const std::function& func){ w...
shangjiaxuan
1

votes
1

answer
126

Views

Unable to select bits in Microsoft VC++ Inline ASM

Quite simple, really. I tried to use EAX[31:26] in my code, and was presented with the following error: error C2400: inline assembler syntax error in 'second operand'; found ':' And here's my code: unsigned _EAX, _EBX, _ECX, _EDX ; //LoadCPUID(EAX_CACHECONFIG, _EAX, _EBX, _ECX, _EDX); __asm { mov EA...
LMS
1

votes
1

answer
1.8k

Views

Can you suggest a tutorial on creating Unmanaged DLL using Microsoft Visual C++? [closed]

I have searched a lot, but not found a good tutorial on Microsoft Visual C++ unmanaged dll. If somebody has done work on this before or know of such tutorial, do share it with me.
Amit Pandey
1

votes
2

answer
1.4k

Views

Need help in including lib file in my vc++ project

First of all i am a beginner in visual studio so please forgive and guide me if i m going wrong in some way , i am a java and php programmer so i am not new to programming i want to develop a application which reads fingerprint , i use this device http://www.egistec.com/en/sensors/fingerprint-es603w...
Naveen Margan
1

votes
2

answer
292

Views

C++ srand function looping

I have the following method as part of a password generating program to generate a random password which is then validated. My problem is that the srand function never meets the validation requirements and keeps looping back to create a new password. Im posting the code below to ask if anyone has a...
Brian J
1

votes
2

answer
318

Views

insert std::map in std::map

I have a container of std::map. How do I insert data into such a container? Do I have to have an inner map as additional variable or not? The code should compile under both MSVC 2010 and XCode 4.2 (Snow Leopard). Is XCode 4.2 under Snow Leopard (10.6) supports such a container?
Igor
1

votes
1

answer
99

Views

invoke C function from C# using P/Invoke

I have a C function, which is part of a VS 2010 project and has this signature: real_T wrapper(void) where typedef double real_T; In my C# code I attempt this: [DllImport(@"C:\Users\bla\Documents\Visual Studio 2010\Projects\bla\bla\Debug\bladibla.dll")] public static extern double wrapper(); static...
cs0815
1

votes
6

answer
3.9k

Views

Assigning random numbers to an array and checking for duplicates

i was given an assignment to create an array of 100 elements and assign it random values using rand () function and to check if there are duplicates within the array or not. I have completed the code and its running fine but i'm not sure whether its actually checking for duplicates or just printing...
Usama Khurshid
1

votes
1

answer
423

Views

Visual Studio Compiler Default for /O

Does VS2010/12's compiler use a default optimization level when none of /Od,/O1,/O2,/Ox is provided in a C++ compilation command line? I'm currently using /Od since I witnessed some optimization related bugs when using the other levels. However, this leads to /GS being disabled - which is unwanted....
Danra
1

votes
1

answer
534

Views

Is a const HANDLE really const?

As far is I learned a HANDLE is just a number referring to some kind of "sytem ressource table". Is this handle const correct? I guess not because it is just used to access a table like an index on an array. An example with bitmaps: Can I change the content of a bitmap althought the HBITMAP is decla...
ManuelSchneid3r
1

votes
3

answer
230

Views

Is there any way to shorten this code?

This is my code on Q&A game on Visual C++ if (this->answer->Text == "2"){ this->question->Text = "2+2?"; } else if (this->answer->Text == "4"){ this->question->Text = "3+3?"; } else if (this->answer->Text == "6"){ this->question->Text = "4+4?"; } else if (this->answer->Text == "8"){ this->question-...
JFetz2191
1

votes
1

answer
2.3k

Views

Incorrect debugging of Win32 program on 64 bit OS

Windows 7 64 bit, Visual Studio 2010, Console C++ application, Win32 Debug configuration: #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { char* p = NULL; *p = 1; return 0; } Start Debugging. Obviously, I get this error messsge: Unhandled exception at 0x77d915de in test.exe: 0xC0000005: Ac...
Alex F
1

votes
1

answer
4.6k

Views

how to do string comparison on C LPWSTR?

In Visual C 2010 how do you do a string comparison to check for equality between a char* and a LPWSTR? For example, do something to the extent of LPWSTR *str; if (*str == "fileName") //...
T. Webster
1

votes
1

answer
307

Views

GC and unmanaged code in C# / C++

I have a silly question. If I have an array in C++, that I am using to store a number of references (I'm guessing IntPtrs, haven't gotten that far yet) to various C# objects, how does the GC in C# know not to collect these objects? I mean, the mark and sweep algorithm can't see into the unmanaged co...
user978122
1

votes
1

answer
994

Views

error C2664: 'SQLGetData' : cannot convert parameter 6 from 'SDWORD *' to 'SQLLEN *'

I have the code that compiled on Visual Studio 2008 in 32 bit mode. Now I am trying to compile the same in 64 bit mode. Point where I am having this error is: SDWORD temp=0; SDWORD & readlen = (pValue?*pValue:temp); retValue=::SQLGetData(hStatement,mCurrentCol=column,cType,actualbuff,len,&readlen)...
Vivek
1

votes
2

answer
1.2k

Views

read memory from pointer

I have a function like this: int __stdcall sub_57BBD0(int a1, int a2, int a3, char a4) { *(_BYTE *)a3 = *(_BYTE *)a1; } *(BYTE*)(a1 + 0) is a pointer to a BYTE* from the pointer of a1, how can I get the BYTES data that this that pointer points to? or is it impossible?, Because a1 points to a BYTE* i...
Dean
1

votes
3

answer
1.9k

Views

Subscribe PropertyChanged events of window in C++/CLI

I just tried to subscribe to WPF property change events using C++/CLI. I didn't expect this to get difficult. First I tried to subscribe to a specific property of some window (IsMouseDirectlyOver) and finally succeeded with following code: void MyClass::DependencyPropertyChanged(Object^ sender, Depe...
Silicomancer
1

votes
3

answer
983

Views

Which is the better way of calculating frame motion in a video?

In order to find successive frame motion differences, I used absolute difference of the frames and then summing up all the pixels to quantify the amount motion. I have done that in OpenCV. But I recently came to know about Horn and Schunk's Optical flow algorithm and the Macro-Block based motion com...
Animesh Pandey
1

votes
1

answer
1.4k

Views

weird about send udp packet to local lan

I'm using visual studio 2003 to write a simple program of communcation with local LAN via UDP socket. And I'm trying to not use MFC. The following is a small piece of code I used to test UDP socket: static void sendMsg(char *buf, int len) { SOCKET sock; struct sockaddr_in addr; sock = socket(AF_INET...
TieDad
1

votes
2

answer
765

Views

How to make a program as a default program to open specific files in Visual Studio C++

Actually, I have no idea about what is the title of my question, so I couldn't search on Google, first I need to know what to say to this problem. Well, I have developed a application in Visual Studio C++ 2010, in which 3D objects can be processed, so there is a function called Import Model which...
maxpayne
1

votes
2

answer
4.2k

Views

MSVC 2010 - Error 0xc000007b when building in x64

The title is pretty straightforward - I can't get anything at all to run when building in x64 and I get a message box with this error code. Do you know what may be the problem here?
Philip
1

votes
4

answer
777

Views

Removing a node from a linked list in c++

I'm trying to learn C++ and there is a small confusion I have. The text which I am learning from tells me that if I want to delete a node of type const T& I should first create a new pointer of that node type, then delete it using the inbuilt C++ delete[]. However, what happens if I just set the lin...
Evil Washing Machine
1

votes
1

answer
137

Views

Reference issues in Visual Studio 2010

I have a Visual Studios Solution with two projects, one VB.net the other VC++. The VC++ project is a wrapper around Nvidia's Driver API called Nvapi. It is a nvapi.lib file and the associated header files. My code compiles and runs fine on my development machine but I tried copying the whole solutio...
Alexander Van Atta

View additional questions