Visual C++ get path and filename to TextBox - winforms

I want display full path + name + extension of image file to Visual C++ TextBox (Windows Form), when i try to build that, it's failed:
1>------ Build started: Project: Testing, Configuration: Debug Win32 ------
1> Testing.cpp
1>Testing.obj : error LNK2020: unresolved token (06000003) Testing.Form1::GetFileName
1>c:\users\febri nur hidayat\documents\visual studio 2010\Projects\Testing\Debug\Testing.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
here is my source code :
private: System::Void textBox1_Click(System::Object^ sender, System::EventArgs^ e) {
if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK){
this->pictureBox1->Image = Image::FromFile(openFileDialog1->FileName);
String^ sourceImage;
citra = Path::GetFileName(openFileDialog1->FileName);
this->textBox1->Text = sourceImage;
}
}
any advice or what should i code?

Related

cppcheck: error: unrecognized command line option: "--file-filter

I am developing C code on Ubuntu 20.04.
By running cppcheck -q --project=build/proj1/compile_commands.json --file-filter='src/base/Myfile.c'
I got the error
cppcheck: error: unrecognized command line option: "--file-filter=src/base/Myfile.c".
It looks like the version of cppcheck included in Ubuntu 20.04 is not the latest:
$ apt show cppcheck | grep Version
Version: 1.90-4build1
cppcheck 1.90 was released in 2019. The --file-filter argument was introduced in commit fcd5cda97 in 2020:
$ git show fcd5cda97f10085c7def7fda6fc6199f624010ce
commit fcd5cda97f10085c7def7fda6fc6199f624010ce
Author: fuzzelhjb <chschmidt9#gmail.com>
Date: Fri Jan 10 08:57:37 2020 +0100
Check selected files from project (#2378)
diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp
index 3fbc7f6c6..292327051 100644
--- a/cli/cmdlineparser.cpp
+++ b/cli/cmdlineparser.cpp
## -376,6 +376,10 ## bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
mSettings->xml = true;
}
+ // use a file filter
+ else if (std::strncmp(argv[i], "--file-filter=", 14) == 0)
+ mSettings->fileFilter = std::string(argv[i] + 14);
+
// Only print something when there are errors
else if (std::strcmp(argv[i], "-q") == 0 || std::strcmp(argv[i], "--quiet") == 0)
mSettings->quiet = true;
## -1035,6 +1039,9 ## void CmdLineParser::printHelp()
" --exitcode-suppressions=<file>\n"
" Used when certain messages should be displayed but\n"
" should not cause a non-zero exitcode.\n"
+ " --file-filter=<str> Analyze only those files matching the given filter str\n"
+ " Example: --file-filter=*bar.cpp analyzes only files\n"
+ " that end with bar.cpp.\n"
" --file-list=<file> Specify the files to check in a text file. Add one\n"
" filename per line. When file is '-,' the file list will\n"
" be read from standard input.\n"
The current release version of cppcheck appears to be 2.7.

do_rootfs function failed in yocto project

I am just getting started with the yocto project and trying to build an image for x86 architecture to be emulated using QEMU emulator (running on Ubuntu 16.04 ).I am getting the following error while building the OS image.
ERROR: core-image-sato-1.0-r0 do_rootfs: Error executing a python function in exec_python_func() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:do_rootfs(d)
0003:
File: '/home/rahul/poky/poky/meta/classes/image.bbclass', lineno: 258, function: do_rootfs
0254: progress_reporter.next_stage()
0255:
0256: # generate rootfs
0257: d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
*** 0258: create_rootfs(d, progress_reporter=progress_reporter, logcatcher=logcatcher)
0259:
0260: progress_reporter.finish()
0261:}
0262:do_rootfs[dirs] = "${TOPDIR}"
File: '/home/rahul/poky/poky/meta/lib/oe/rootfs.py', lineno: 1010, function: create_rootfs
1006: env_bkp = os.environ.copy()
1007:
1008: img_type = d.getVar('IMAGE_PKGTYPE')
1009: if img_type == "rpm":
*** 1010: RpmRootfs(d, manifest_dir, progress_reporter, logcatcher).create()
1011: elif img_type == "ipk":
1012: OpkgRootfs(d, manifest_dir, progress_reporter, logcatcher).create()
1013: elif img_type == "deb":
1014: DpkgRootfs(d, manifest_dir, progress_reporter, logcatcher).create()
File: '/home/rahul/poky/poky/meta/lib/oe/rootfs.py', lineno: 201, function: create
0197: if self.progress_reporter:
0198: self.progress_reporter.next_stage()
0199:
0200: # call the package manager dependent create method
*** 0201: self._create()
0202:
0203: sysconfdir = self.image_rootfs + self.d.getVar('sysconfdir')
0204: bb.utils.mkdirhier(sysconfdir)
0205: with open(sysconfdir + "/version", "w+") as ver:
File: '/home/rahul/poky/poky/meta/lib/oe/rootfs.py', lineno: 450, function: _create
0446: rpm_pre_process_cmds = self.d.getVar('RPM_PREPROCESS_COMMANDS')
0447: rpm_post_process_cmds = self.d.getVar('RPM_POSTPROCESS_COMMANDS')
0448:
0449: # update PM index files
*** 0450: self.pm.write_index()
0451:
0452: execute_pre_post_process(self.d, rpm_pre_process_cmds)
0453:
0454: if self.progress_reporter:
File: '/home/rahul/poky/poky/meta/lib/oe/package_manager.py', lineno: 543, function: write_index
0539:
0540: def write_index(self):
0541: lockfilename = self.d.getVar('DEPLOY_DIR_RPM') + "/rpm.lock"
0542: lf = bb.utils.lockfile(lockfilename, False)
*** 0543: RpmIndexer(self.d, self.rpm_repo_dir).write_index()
0544: bb.utils.unlockfile(lf)
0545:
0546: def insert_feeds_uris(self, feed_uris, feed_base_paths, feed_archs):
0547: from urllib.parse import urlparse
File: '/home/rahul/poky/poky/meta/lib/oe/package_manager.py', lineno: 105, function: write_index
0101: else:
0102: signer = None
0103:
0104: createrepo_c = bb.utils.which(os.environ['PATH'], "createrepo_c")
*** 0105: result = create_index("%s --update -q %s" % (createrepo_c, self.deploy_dir))
0106: if result:
0107: bb.fatal(result)
0108:
0109: # Sign repomd
File: '/home/rahul/poky/poky/meta/lib/oe/package_manager.py', lineno: 21, function: create_index
0017:def create_index(arg):
0018: index_cmd = arg
0019:
0020: bb.note("Executing '%s' ..." % index_cmd)
*** 0021: result = subprocess.check_output(index_cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
0022: if result:
0023: bb.note(result)
0024:
0025:"""
File: '/usr/lib/python3.5/subprocess.py', lineno: 626, function: check_output
0622: # empty string. That is maintained here for backwards compatibility.
0623: kwargs['input'] = '' if kwargs.get('universal_newlines', False) else b''
0624:
0625: return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
*** 0626: **kwargs).stdout
0627:
0628:
0629:class CompletedProcess(object):
0630: """A process that has finished running.
File: '/usr/lib/python3.5/subprocess.py', lineno: 708, function: run
0704: raise
0705: retcode = process.poll()
0706: if check and retcode:
0707: raise CalledProcessError(retcode, process.args,
*** 0708: output=stdout, stderr=stderr)
0709: return CompletedProcess(process.args, retcode, stdout, stderr)
0710:
0711:
0712:def list2cmdline(seq):
Exception: subprocess.CalledProcessError: Command '/home/rahul/poky/poky/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/recipe-sysroot-native/usr/bin/createrepo_c --update -q /home/rahul/poky/poky/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo' returned non-zero exit status 1
Subprocess output:
Temporary repodata directory /home/rahul/poky/poky/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo/.repodata/ already exists! (Another createrepo process is running?)
ERROR: core-image-sato-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/rahul/poky/poky/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/temp/log.do_rootfs.5019
ERROR: Task (/home/rahul/poky/poky/meta/recipes-sato/images/core-image-sato.bb:do_rootfs) failed with exit code '1'
Build process runs upto almost 90 percent after which this error comes up which terminates the process.What could be the issue ?
I got the same error when my host machine shut down abruptly, but everything worked well after I delete the .repodata folder with sudo rm -r build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo/.repodata/ and then build again.
I stopped a build using Ctrl-C and got the python error described in the original question.
The .repodata folder (please see the answer from jmiranda) was empty. So I deleted the oe-rootfs-repo folder and this worked for me.
I get the same issue, but with error "Directory not empty" instead, when building in Docker container. Deleting the destination directory using rm -r, and running the build again, works.
None of these methods worked for me.
I then clean the build using bitbake -c clean mybuildname and then again made the build and it worked flawlessly, i hope it helps someone.

FltRegisterFilter not working

I'm trying to create a simple windows driver, but the FltRegisterFilter is not working ! I got the following error code : 0xc0000034 (I think it refers to the STATUS_OBJECT_NAME_NOT_FOUND error code).
Do you know if the generated INF file is enough ? I just tried to add this line in a driver install section : Dependencies = FltMgr.
Here is the full INF file :
;
; KmdfMiniFilter.inf
;
[Version]
Signature="$WINDOWS NT$"
Class=Sample ; TODO: edit Class
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
Provider=%ManufacturerName%
CatalogFile=KmdfMiniFilter.cat
DriverVer=01/01/2017 ; TODO: set DriverVer in stampinf property pages
[DestinationDirs]
DefaultDestDir = 12
; ================= Class section =====================
[ClassInstall32]
Addreg=SampleClassReg
[SampleClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,-5
[SourceDisksNames]
1 = %DiskName%,,,""
[SourceDisksFiles]
KmdfMiniFilter.sys = 1,,
;*****************************************
; Install Section
;*****************************************
[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$
[Standard.NT$ARCH$]
%KmdfMiniFilter.DeviceDesc%=KmdfMiniFilter_Device, Root\KmdfMiniFilter ; TODO: edit hw-id
[KmdfMiniFilter_Device.NT]
CopyFiles=Drivers_Dir
[Drivers_Dir]
KmdfMiniFilter.sys
;-------------- Service installation
[KmdfMiniFilter_Device.NT.Services]
AddService = KmdfMiniFilter,%SPSVCINST_ASSOCSERVICE%, KmdfMiniFilter_Service_Inst
; -------------- KmdfMiniFilter driver install sections
[KmdfMiniFilter_Service_Inst]
DisplayName = %KmdfMiniFilter.SVCDESC%
ServiceBinary = %12%\KmdfMiniFilter.sys
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
LoadOrderGroup = "FSFilter Activity Monitor"
Dependencies = FltMgr
;
;--- KmdfMiniFilter_Device Coinstaller installation ------
;
[DestinationDirs]
KmdfMiniFilter_Device_CoInstaller_CopyFiles = 11
[KmdfMiniFilter_Device.NT.CoInstallers]
AddReg=KmdfMiniFilter_Device_CoInstaller_AddReg
CopyFiles=KmdfMiniFilter_Device_CoInstaller_CopyFiles
[KmdfMiniFilter_Device_CoInstaller_AddReg]
HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"
HKR,"Instances","DefaultInstance",0x00000000,%DefaultInstance%
HKR,"Instances\"%Instance1.Name%,"Altitude",0x00000000,%Instance1.Altitude%
HKR,"Instances\"%Instance1.Name%,"Flags",0x00010001,%Instance1.Flags%
[KmdfMiniFilter_Device_CoInstaller_CopyFiles]
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
[SourceDisksFiles]
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames
[KmdfMiniFilter_Device.NT.Wdf]
KmdfService = KmdfMiniFilter, KmdfMiniFilter_wdfsect
[KmdfMiniFilter_wdfsect]
KmdfLibraryVersion = $KMDFVERSION$
[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName="<Your manufacturer name>" ;TODO: Replace with your manufacturer name
ClassName="Samples" ; TODO: edit ClassName
DiskName = "KmdfMiniFilter Installation Disk"
KmdfMiniFilter.DeviceDesc = "KmdfMiniFilter Device"
KmdfMiniFilter.SVCDESC = "KmdfMiniFilter Service"
DefaultInstance = "KmdfMiniFilter"
Instance1.Name = "KmdfMiniFilter"
Instance1.Altitude = "370120"
Instance1.Flags = 0x0 ; Allow all attachments
Do you have any idea of what is the problem ?
I finally solved my problème thanks to RbMm !
A minifilter is not a WDM driver, so :
it doesn't have any hardware id
a good example of inf file : https://github.com/Microsoft/Windows-driver-samples/blob/master/filesys/miniFilter/nullFilter/nullFilter.inf
we can't install a minifilter from Visual Studio, so in Deployment settings, check "Not install". The files will be sent on the target machine. Then, go in you driver's folder (mine was : C:\DriverTest\Drivers). The sys file must be in the same directory than the inf file. Right-click on the inf file -> Install. And finally, open a prompt command (administrator), and use the following command to load and unload your filter : fltmc load myFilter.
Then, once your filter loaded, you must be able to debug it from Visual !

c++/clr Get Data of child form

in Form1
public: System::Windows::Forms::Label^ TUserName;
in Form2
public: System::Windows::Forms::Label^ OutTex;
in Form2 click button B1
private: System::Void B1_Click(System::Object^ sender, System::EventArgs^ e) {
Form1^ RunC = gcnew Form1;
OutTex->Text = RunC->TUserName->Text;
}
compile error
Error 1 error C2065: 'Form1' : undeclared identifier d:\Project\Form2.h 1030 1 Project1
Error 2 error C2065: 'RunC' : undeclared identifier d:\Project\Form2.h 1030 1 Project1
Error 3 error C2061: syntax error : identifier 'Form1' d:\Project\Form2.h 1030 1 Project1
Error 4 error C2065: 'RunC' : undeclared identifier d:\Project\Form2.h 1032 1 Project1
Error 5 error C2227: left of '->TUserName' must point to class/struct/union/generic type d:\Project\Form2.h 1032 1 Project1
Error 6 error C2227: left of '->Text' must point to class/struct/union/generic type d:\Project\Form2.h 1032 1 Project1
please help me for Solve this problem

ExtJS 4.2.0 error: Layout run failed

I am using the Bryntum Scheduler v 2.2.5 with Exts JS 4.2.0
I have added the diagnostic tools and the console output is below.
I am using a Sch.panel.SchedulerTree.
Is this diagnostic telling me I need to set a width
for the SchedulerTree SchedulerGrid headercontainer columns?
==================== LAYOUT ====================
[E] Layout run failed
[E] ----------------- FAILURE -----------------
--schedulergridview-1036<tableview> - size: calculated/calculated
triggeredBy: count=1
headercontainer-1035.columnWidthsDone () dirty: false, setBy: ?
Cycles: 2, Flushes: 0, Calculates: 1 in 2 msec
Calculates by type:
tableview: 1 in 1 tries (1x) at 0 msec (avg 0 msec)
I added
schedulerConfig{ layout: 'auto'}
to my 'Sch.panel.SchedulerTree' and my 'Layout run failed' error is gone!

Resources