Quantcast
Channel: Visual C forum
Viewing all 15302 articles
Browse latest View live

Missing api-ms-win-core-rtlsupport-l1-2-0.DLL after building C++ with Visual Studio 2015

$
0
0

hi friend:

I am suffering this build problem. After installed Visual Studio 2015 and update 1, which took 4 hours, then I built my code. But when I tried to run generated executable files (by vc140), it is complaining error in debug mode like"The program can't start because api-ms-win-core-rtlsupport-l1-2-0.DLL is missing from your computer. Try reinstalling the program to fix this problem." My OS is windows 7 Service pack 1. I has been working with VS2013 for more than 2 years, never had this kinds of problems before.

Can anyone help to diagnose what kind of problem was it? Did I miss any package during installation? I have searched on other google web site, didn't find any helpful information. Also I installed vc_redist.x64.exe, but it doesn't help.

Please help because it is blocking me from making further progress on my coding work!!!  Thanks a lot.


I cant seem to find the problem of this code

$
0
0

I was trying to find the roots of a quadratic equation in C++.Their two problems :its shows me ' Expected ";"   before string constant  '.The other problem is that the variables "tot2 " and "tot3 "are showing"nan" in the output when I skipped the debugging . Thanks in advance!

#include <iostream>
#include <cmath>
using namespace std;

int main ()
{
    float a,b,c ;
    float disc,tot1,tot2,tot3;

    cout <<"Enter number a:  ";
    cin >> a;
    cout <<"Enter number b:  ";
    cin >> b;
    cout <<"Enter number c:  ";
    cin >> c;

    disc = (b*b)-4*a*c;
    tot1 = ((sqrt(disc)));
    tot2 = -b + tot1/(2*a);
    tot3 = -b - tot1/(2*a);

    cout <<"Roots are :  ,   ";
    cout << tot2 "\t" << tot3 :"\t" ;
    return 0;

}


Real-time animation problem

$
0
0

My program draws a picture and then animates it, showing moving parts.  This works as long as Windows is not doing anything else.  But if I open an Internet site, or sometimes for other reasons, the display freezes while Windows does its other task.

Is there any way to tell Windows to keep my display active until the animation is over?

CfSetInSyncState does not behave as documented. (CfAPI)

$
0
0

I try to use CfSetInSyncState with an USN.

The [documentation][1] says that you can provide an USN and the change will only performed when the USN still matches.

However calling the Method on an NOT_IN_SYNC file with the current USN will not succeed. It returns `0x80070179` "The File is not in sync with the cloud" (translated from German, so maybe the text does not 100% match). The returned USN value did also not changed. 

I have a minimal sample on [github][0] that will demonstrate this.

I have tried different flags to obtain the handle and also using the CreateFile method instead. Opening the file also does not seems to change the USN. But until know I wasn't able to set SyncState if USN was provided nor I could retrieve the current USN from the function.

Somehow my account is not verified, and I don't know what I can do to verify it. So I can't post links. Sorry for the inconvenience.

[0]: https://github.com/LokiMidgard/CloudTest

[1]: https://docs.microsoft.com/en-us/windows/win32/api/cfapi/nf-cfapi-cfsetinsyncstate?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev16.query%3FappId%3DDev16IDEF1%26l%3DEN-US%26k%3Dk(CFAPI%2FCfSetInSyncState)%3Bk(CfSetInSyncState)%3Bk(DevLang-C%2B%2B)%3Bk(TargetOS-Windows)%26rd%3Dtrue

VS2019 c++ simple console app throws Error MSB6006 "CL.exe" exited with code 2.

$
0
0

Hello I recently updated my VS from 2017 to 2019 and from now on I cant compile any c++ projects created by VS2019 it throws error: Error MSB6006 "CL.exe" exited with code 2. 

Code to reproduce error: 

int main()
{
  return 0;
}
First thing I done is repair VS because I though there is corruped file, but that didnt helped so I started messing with settings,

Changing Properties > C/C++ > Advanced > Compile As > to C code /TC app compiles and work, setting default or /Tp it throws again Error MSB6006 "CL.exe" exited with code 2., changing platform from x64 to x84 works too, but currently as I write it does not work anymore, already deleted bin and obj folders but it didnt help, also noticed that VS19 does not create any precompiled headers, if I copy paste settings and pre-header files it throws error that it unable to find myproject.pch files, I believe because of not set pre-headers its related that compiler throws error Error MSB6006 "CL.exe" exited with code 2. 

C++ - how can i read an image file?

$
0
0
the image file is a binary file and it's a structure file.
i can read the image size from BMP, JPG and GIF.
now i'm trying read from an Icon file.
heres the structure:
All values in ICO/CUR files are represented in little-endian byte order.

Header

ICONDIR structure
Offset#	Size (in bytes)	Purpose
0	2	Reserved. Must always be 0.
2	2	Specifies image type: 1 for icon (.ICO) image, 2 for cursor (.CUR) image. Other values are invalid.
4	2	Specifies number of images in the file.
Structure of image directory

Image #1	Entry for the first image
Image #2	Entry for the second image
...	
Image #n	Entry for the last image


Image entry
ICONDIRENTRY structure
Offset#	Size (in bytes)	Purpose
0	1	Specifies image width in pixels. Can be any number between 0 and 255. Value 0 means image width is 256 pixels.
1	1	Specifies image height in pixels. Can be any number between 0 and 255. Value 0 means image height is 256 pixels.
2	1	Specifies number of colors in the color palette. Should be 0 if the image does not use a color palette.
3	1	Reserved. Should be 0.[Notes 2]
4	2	In ICO format: Specifies color planes. Should be 0 or 1.[Notes 3]
In CUR format: Specifies the horizontal coordinates of the hotspot in number of pixels from the left.

counting the bytes, the width is on 6 position..
so i did these code:
namespace little_endian
{
  unsigned read_word( std::istream& ins )
  {
    unsigned a = ins.get();
    unsigned b = ins.get();
    return b << 8 | a;
  }
}



FileImage.seekg( 6 );
            height = little_endian::read_word( FileImage );
            FileImage.seekg( 7 );
            width  =  little_endian::read_word( FileImage );
but i get zero from both and i don't know why :(
i'm new reading image files and more without using the structure, but i only need the size and learn more about it.
yes i have these same question on other forums, for i learn what i can about it.

Printer defaults

$
0
0

On launching my program, I'm asking for the default printer details with a PRINTDLG using parameters
PD_RETURNDEFAULT|PD_RETURNIC to get an information context, and thence finding details with GetDeviceCaps( hDC, …).

When I work out the paper size from the pixel area and DPI, it's exactly 11" x 8.5" - US Letter.

Now the printer, a Brother HL2150N (oldish now) will accept US Letter, but the tray is loaded with A4 paper, and the settings in Windows 10 are all set to A4.

Is this a printer driver problem (trying to update it has changed nothing) or is there something else I should be doing to get it to report correct values.

(I *can* change it to A4 in my PageSetup dialogue box, but I shouldn't have to!)

Dave

 

David Webber Author of Mozart music notation software http://www.mozart.co.uk

what are the alternatives of curl in c++?

$
0
0

i am working on a project in which i have to send data from client pc to my server for now i am using curl for sending data to my server which is then processing data in php aand stores it in database.

But curl is not light weight its increasing size of my exe significantly besides that i want to know what are the alternatives i can use to send some string format data and files from c++ client side to my server php side.

please give a small example of uploading too


The precision of numbers is lost when initializing Gdiplus::PointF class instanse.

$
0
0

Hello. For drawing lines (edges of triangles) I use the following GDI+ function:

Status DrawLine(
  IN const Pen      *pen,
  IN const PointF & pt1,
  IN const PointF & pt2
);

I have the structure that I use.

// Represents the edge of a triangle that is part of the set 
// of triangles drawn in the application window that make up
// the triangulation mesh.
struct EdgeToDraw
{
	EdgeToDraw() {}

	EdgeToDraw(long X_begin, long Y_begin, long X_end, long Y_end)
	{
		Begin.X = X_begin;
		Begin.Y = Y_begin;
		End.X = X_end;
		End.Y = Y_end;
	}
	// X and Y coordinates of begin edge vertex.
	PointF Begin;
	// X and Y coordinates of end edge vertex.
	PointF End;
};

The thread of constructing a triangulation places the coordinates of the edges in the concurrent_queue container

concurrent_queue<EdgeToDraw> MeshEdgesBuffer;

and another thread takes them from there (in WndProc WM_PAINT) in order to draw. Below I show how I put instances of EdgeToDraw in a concurrent_queue container.

// Add an edge for the drawn triangulation mesh.
MeshEdgesBuffer.push(EdgeToDraw(X_begin, Y_begin, X_end, Y_end));
But here, the accuracy of the added values is lost. For example if X_begin == -0.522 and Y_begin == 2.169 (where X_begin and Y_begin havedouble type), then MeshEdgesBuffer[0].Begin.X == 0 and MeshEdgesBuffer[0].Begin.Y == 2. And so on. But for me, the numbers to the right of the decimal point are very important. Highly. As I understand it, the PointF class is specifically designed to express coordinates with decimal point values. Please tell me what I am doing wrong and how can I make sure that the accuracy of numbers is not lost? That is, ifX_begin == -0.522, then Begin.X is of the same value (-0.522) but not is0 or 0.000. Thank you in advance.



cfapi: the cloud operation is invalid

$
0
0

Hi!

I'm making a Cloud Sync Engines Supports Placeholder based on CloudMirror. And got problem on CF_CALLBACK_TYPE_FETCH_DATA

When i double click file (placeholder) in window explorer, app trigger FILE_ATTRIBUTE_PINNED and Hydrating file. Next, cfapi call FETCH_DATA and read asynchronous file (my app work look same with CloudMirror). But i got HRESULT return from CfExecute is0x8007017c the cloud operation is invalid. Debug look all value is true, then how to resolve it, thank.

Here (line 52-262) create pipe stream and do same like CloudMirror on winrt dll.
And here (63-209) for try cfexecute in another thread(task) in c++\clr

___________________________________
And more question, when i edit here.

if (FakeCloudProvider::Start(L"D:\\ServerFolder",L"D:\\ClientFolder"))
When CloudMirror FETCH_DATA, CfExecute return HRESULT 0x8007018E The cloud operation was canceled by user. Look like it not have permission from FileOpenDialog (it not FolderPicker from uwp) then how i can "save" permission?



what are the alternatives of curl in c++?

$
0
0

i am working on a project in which i have to send data from client pc to my server for now i am using curl for sending data to my server which is then processing data in php aand stores it in database.

But curl is not light weight its increasing size of my exe significantly besides that i want to know what are the alternatives i can use to send some string format data and files from c++ client side to my server php side.

please give a small example of uploading too

Mouse and keyboard lag after VS hit the breakpoint

$
0
0

My program is a shell namespace extension. The situation is similar to the following case in Stackoverflow forum. But the problem only happened in VS, When I switched to another program, everything was OK again.

https://stackoverflow.com/questions/17886883/visual-studio-extreme-lag-spikes-while-debugging (It prompts me that I need to verify my account, so that I can post link.)

 

The file is too large to open

$
0
0

I use MFC application (CEditView)  to open > 500MB file in visual studio , the warning message display "The file is too large to open"


I really appreciate if someone could advise me on this issue.


C++ and C# - Is there a way to create a hybird application?

$
0
0

I understand that we can use C++ to create a application (or we can use C#).

However, is it possible to create a hybrid application via Visual Studio such that some classes are written in C++ or some other classes are writing by C# (non complied classes)

Anyone knows about it?  Thank you :-)

How to change/set location to put, save symbol server cache downloaded by visual studio

$
0
0
How change and set the location to put, save symbol server cache downloaded by visual studio which its cache was found out in Windows temporary folder and was moved/saved in another, how to do it in VS setting?

warning MSB8003: The WindowsSDKDir property is not defined

$
0
0

I just installed Visual Studio 2019 in a fresh copy of Windows 10 Pro, but upon rebuilding a preexisting solution I get these warnings:

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(449,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(449,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.

and these errors:

1>C:\Users\Juan Dent\Source\Repos\TransformDownloadedStatements\GridCtrlDll\targetver.h(8,10): fatal error C1083: Cannot open include file: 'SDKDDKVer.h': No such file or directory
2>C:\Users\Juan Dent\Source\Repos\TransformDownloadedStatements\RSAFacade\targetver.h(8,10): fatal error C1083: Cannot open include file: 'SDKDDKVer.h': No such file or directory
2>Done building project "RSAFacade.vcxproj" -- FAILED.
1>Done building project "GridCtrlDll.vcxproj" -- FAILED.
3>------ Build started: Project: ExpenseManagerMFC, Configuration: Release Unicode Win32 ------
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1850,5): warning : The referenced project '..\..\..\..\Documents\Visual Studio 2017\Projects\GettingWMIFromLocalComputer\GetHardDriveSerialNumber\GetHardDriveSerialNumber.vcxproj' does not exist.
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(449,5): warning MSB8003: The WindowsSDKDir property is not defined. Some build tools may not be found.
3>stdafx.cpp
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include\yvals.h(12,10): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
3>Done building project "ExpenseManagerMFC.vcxproj" -- FAILED.
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========

Please help!!

Regards,

Juan Dent


Juan Dent

VS 2917 Can't show variable value in switch-case with debug: Program Database (/Zi) option

$
0
0

VS 2917 Can't show some variables value within switch-case with debug: Program Database (/Zi) option

case IDC_NEXT_DOC :  {

if (::GetFocus()==_findReplaceDlg.getHFindResults()){
switchEditViewTo(MAIN_VIEW);
break;
}
size_t nbDoc;
nbDoc = viewVisible(MAIN_VIEW)? _mainDocTab.nbItem(): viewVisible(SUB_VIEW)? _subDocTab.nbItem() : 0;

(BP) bool doTaskList = NppParameters::getInstance().getNppGUI()._doTaskList;
_isFolding = true;
if (nbDoc > 1)
{
bool direction = id==IDC_NEXT_DOC? dirDown : dirUp;
if (!doTaskList)
activateNextDoc(direction);
else if (!TaskListDlg::_instanceCount)
{
TaskListDlg tld;
HIMAGELIST hImgLst = _docTabIconList.getHandle();
tld.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), hImgLst, direction);
tld.doDialog();
}
}

(BP) is added to tell where the breakpoint is.

Cannot yield nbDoc and doTasklist value, please help!



How to reference memory blocks defined in one .cpp file in another .cpp file?

$
0
0

I am butting my head against it. I defined a few memory blocks in one .cpp file specially for that created. There is also some code in that file that do one time filling the memory with various coefficients. Then I need to reference at least two of the blocks from another .cpp file. It creates numerous problems, either IntelliSense suggestions or a few compile errors. I wrapped the memory blocks into a structure like this.

struct commons{
	float* ptr20[76800];  // will contain theta angles for all points (pixels) of the screen projection on the sphere.
	float* ptr21[76800];  // will contain phi angles for all points (pixels) of the screen projection on the sphere.
	float* ptr22[76800];  // will contain moderating coefficient, close to 1.0 at NP and diminishing to the periphery.
	float* ptr23[76800];  // will contain amplitude of the light intensity in the pixels of the webcam (device.cpp)
} pcom;

If the explanation is clear, please show how this block should be referenced like for instance COMMON in FORTRAN.

Thanks, - MyCatAlex



dde connection fail

$
0
0

hi

hi i had old program on c++ DDE client unfortunately i try use it again it con t connect the application like excel or rslinx even that was working before

 

Visual Studio warn "…C2220: warning treated as error - no 'object' file generated..."

Viewing all 15302 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>