header file error in visual c++ - visual-c++

I am newbie in visual c++.i have created a small program,but its showing error C1083.
My program is like this:
#include <iostream.h>
using namespace std;
void main()
{
cout <<"Welcome to cpp program";
}
the error report is :
1>------ Build started: Project: payroll, Configuration: Debug Win32 ------
1> first_page.cpp
1>c:\users\naga\documents\visual studio 2010\projects\payroll\payroll\first_page.cpp(1):
fatal error C1083:
Cannot open include file: 'iostream.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
i have seen that i should do something with the properties.But i didnt understand that stuff.Also When i click the toolbar and property window,no item appears inside them.I doubt this comes coz i have selected win 32 console application???

std include headers do not need the .h
#include <iostream>
should work.

Related

Why unused namespace defined in xaml file breaks generation of protobuf files?

i have simple WPF project to demonstrate my issue
this is my build log
Rebuild started...
1>------ Rebuild All started: Project: WpfApp, Configuration: Debug Any CPU ------
Restored d:\projects\GrpcError\WpfApp\WpfApp.csproj (in 6 ms).
1>d:\projects\GrpcError\WpfApp\MainWindow.xaml.cs(2,14,2,20): error CS0234: The type or namespace name 'Protos' does not exist in the namespace 'WpfApp' (are you missing an assembly reference?)
1>Done building project "WpfApp_khdt0wpw_wpftmp.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
funny part is that visual studio (2022) correctly navigates to generated file (d:\projects\GrpcError\WpfApp\obj\Debug\net6.0-windows\Protos\Login.cs) with namespace WpfApp.Protos.Core defined ...
i managed to track this error to MainWindow.xaml file -
compilation will be successfull if i remove this line: xmlns:local="clr-namespace:WpfApp"
any idea why is this happening?

Linux Kernel Driver Compilation Error on STM32MP1

I'm trying to compile a kernel module in Yocto on a STM32MP1 target. I can compile a helloworld example without problem. But as soon as I want to compile following:
#include <linux/platform_device.h>
#include <linux/module.h
#include <linux/types.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Robert W. Oliver II");
MODULE_DESCRIPTION("A simple example Linux module.");
MODULE_VERSION("0.01");
static struct platform_device *pdev;
static int __init fake_eth_add(void)
{
int inst_id = 0;
pdev = platform_device_alloc("fake-eth", inst_id);
return 0;
}
static void __exit fake_eth_put(void)
{
}
module_init(fake_eth_add);
module_exit(fake_eth_put);
I'm getting the following error:
root#txmp-1570:/home/rdm/ethtest# make
make -C /lib/modules/5.7.1/build M=/home/rdm/ethtest modules
make[1]: Entering directory '/lib/modules/5.7.1/build'
MODPOST 1 modules
ERROR: modpost: "platform_device_alloc" [/home/rdm/ethtest/eth-ins.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make[1]: *** [Makefile:1642: modules] Error 2
make[1]: Leaving directory '/lib/modules/5.7.1/build'
make: *** [Makefile:9: modules] Error 2
The header platform_device.h file is there, but no *.c module as it should be in a platform_device.c file.
My question is, do I need to do any parameter settings in the kernel? If yes, which would it be? So far I didn't find anything with google help regarding platform_device and kernel settings.

Error in Xamarin.iOS build: Given path's format is not supported

In an iOS project in Visual Studio 2015, networked to a Mac, I get this error on build...
C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(411,3): error : The given path's format is not supported.
The same solution copied to the Mac builds and runs OK in Visual Studio for Mac preview.
Xamarin.iOS.Common.targets, at line 411 position 3 is this:
<SmartCopy
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
SourceFiles = "#(_BundleResourceWithOutputPath)"
DestinationFiles = "#(_BundleResourceWithOutputPath -> '%(OutputPath)')"
/>
Question: Ids there any way tosee what these tokens resolve to at build-time?
Note: Here is the build output that fails...
. . .
1> Copying file from '/Users/user123483/Library/Caches/Xamarin/mtbs/builds/TrySpeechPlus/d33d40e519762246de1faff7c177fd44/obj/iPhoneSimulator/Debug/optimized/Images/whtball2.PNG' to '/Users/user123483/Library/Caches/Xamarin/mtbs/builds/TrySpeechPlus/d33d40e519762246de1faff7c177fd44/bin/iPhoneSimulator/Debug/TrySpeechPlus.app/Images/whtball2.PNG'
1> SmartCopy: 2017-02-11T10:05:56.0785600-05:00 - Deserializing outputs
1> SmartCopy: 2017-02-11T10:05:56.0805590-05:00 - Creating output items
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(411,3): error : The given path's format is not supported.
1> SmartCopy: 2017-02-11T10:05:56.1110734-05:00 - Finished
1>Done executing task "SmartCopy" -- FAILED.
1>Done building target "_CopyResourcesToBundle" in project "TrySpeechPlus.csproj" -- FAILED.
1>
1>Build FAILED.
Can anyone suggest what the problem might be?
The error is caused by the space in the filename (Program Files (x86)).
A fix is to replace the space with the correct escape string
Replace(" ","%20")

MsXml6 failing to link properly

Hello I am trying to use msxml and I am getting a linker (VS 2012) error and can't figure out why.
My class file has the following header declaration:
#include <MsXml6.h>
class Foo
{
....
private:
static IXMLDOMDocument* document;
};
I then reference the document with the following (which gives the link error):
CoCreateInstance(CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)&document);
I have the project setup to link against msxml6.lib. The logs are as follows:
Searching C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x64\msxml6.lib:
1> Found IID_IXMLDOMDocument
1> Referenced in Foo.obj
1> Loaded msxml6.lib(msxml6_i.obj)
...
1>Foo.obj : error LNK2001: unresolved external symbol "private: static struct IXMLDOMDocument * Foo::document" (?document#Foo##0PEAUIXMLDOMDocument##EA)
1>Some.exe : fatal error LNK1120: 1 unresolved externals
Is there something important I am missing? Let me know if you need more info.
Thanks!
I found the problem, I forgot to declare the document variable in the source file.

How to get answer from messagebox

I copy
if ((MessageBox::Show(
"Are you sure that you would like to close the form?",
"Form Closing", MessageBoxButtons::YesNo,
MessageBoxIcon::Question) == DialogResult::No))
{
// cancel the closure of the form.
Application::Exit();
}
From msdn. Where I compiling this i have
1>------ Build started: Project: test2, Configuration: Debug Win32 ------
1> test2.cpp
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(103): error C2039: 'No' : is not a member of 'System::Windows::Forms::Form::DialogResult'
1> c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(16) : see declaration of 'System::Windows::Forms::Form::DialogResult'
1>c:\users\kredkołamacz\documents\visual studio 2010\projects\test2\test2\Form1.h(103): error C2065: 'No' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's wrong? How fix this problem?
I’m stumped but the MSDN article for DialogResult mentions in the C++ example that the type name should be prefixed with :: to make it non-nested. Maybe try this:
if (MessageBox::Show(
"Are you sure that you would like to close the form?",
"Form Closing", MessageBoxButtons::YesNo,
MessageBoxIcon::Question) == ::DialogResult::No)
(I also removed the redundant parentheses …)
If it doesn’t help, try specifying the full namespace, i.e. ::System::Windows::Forms::DialogResult::No to see if that at least works.

Resources