In my main project directory, there is a .TLB file. It has old information in it, and it is compiled into the binary -- which I can tell from looking at the compiled binary in a hex editor.
What's weird is that I updated my .IDL in the main VC++ directory and that's compiled into a .TLB in the project build directory (\Debug), but it's not included into the binary.
I resolved the problem by copying \Debug\Project.TLB into the main directory, but why is the newly compiled .TLB not automatically used for the binary?
The TLB is included via the resource script, so if the .rc file points to the TLB in the main project dir, that's the one that will be used.
Was this project upgraded from an older version of Visual Studio? I seem to recall they changed the default output location at some point.
What you should do is go into the .rc file and adjust the path so it points to the actual output location. It can get a little tricky with separating Debug/Release configurations, though...
Another idea is to change MIDL's output to place the TLB in the main project dir, so that the .rc path points to the right thing.
Related
From a previous question a new one have arisen. I want to include 2 native TFS project libraries stored in two different folders, dependant from each other in my Android Studio project (stored in another folder). If i not specify "../my_lib_path/libFile.h" instead of simply the "libFile.h" i get the error the file is not found. But i dont want to change all includes since it is a TFS project and there are lots of file contained in the libraries!
Your help is highly appreciated!
Add the given directories to those the compiler uses to search for include files. Relative paths are interpreted as relative to the current source directory. So you have to specify "../my_lib_path/libFile.h", that means you need to change all includes, otherwise it will not work.
#Andy Li-MSFT is absolutely right! Though what worked for me in a similar project now was to set a different relative CMakeLists.txt path in the app .gradle file outside the specific Android Studio Project directory:
externalNativeBuild {
cmake {
path "../../whatever_path/my_C_files/CMakeLists.txt"
}
}
After that i was able to compile my C sources flawlessly without changing the include paths of the C project!
I have a Visual C++ for Linux project in VS2017 that I'm building on a Raspberry Pi running Raspbian. This project consists of a single source file (main.c) and an image (test.jpg). When building the project, I want the image file to also be deployed to the pi, so that the code in main.c can do something with it locally. However, I can't figure out how to do this
The image file's Content property is set to True, as is Included in Project. In the project properties, under Copy Sources, Sources to Copy is set to "#(SourcesToCopyRemotely)" and Copy Sources is set to "Yes". However, when I build, only main.c is copied to the Pi, and the compiler output is just a single .out file. I hoped to also see test.jpg there, but alas.
This article mentions that #(SourcesToCopyRemotely) defaults to all files in the project. However, when I evaluate the value of #(SourcesToCopyRemotely, it evaluates to just "main.c".
How do I make sure content files in my projects also end up in the build directory, along with the .out file? Preferably without having to manually enter each filename in a post-build step.
It turns out this is a bug in VC++ for Linux. A workaround, currently, is to use Additional Sources to copy. There's a caveat though: it doesn't work with remote paths that start with ~. So you can't use $(RemoteRootDir) if the Remote Build Root Directory setting is set to the default of "~/projects".
I've currently got Remote Build Root Directory set to "/home/pi/projects" and for each file I want to copy to the build directory I set Additional Sources to Copy to "[filename]:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$Configuration)/[filename]". For instance:
firstimage.png:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$(Configuration)/firstimage.png;secondimage.png:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$(Configuration)/secondimage.png
Right-clicking on the non-source code file to open it's properties page and flagging as Content in the General tab will cause the file to be copied to the remote. There is no need to add anything to the Copy Sources tab. The Copy Sources page of the project properties must show the default of #(SourcesToCopyRemotely). And when you edit this setting the macro should show an expansion with the additional files included.
I have found that it necessary to refresh the macro by clearing Source to Copy and then restoring it to the default after you have marked the additional files as content.
I have encountered problems when the additional files are not in the same folder as the C++ source files on the Windows host and/or you want to put them somewhere else on the remote. There are several open issues on the VCLinux GitHub site like this one so it will be worth reporting any problems you have on there.
[VCLinux 1.0.6 on VS Pro 2017 + Debian Jessie remote]
The "Pre-Build Event" section of the project properties offers "Additional Files To Copy". Addressing my file there (relative to the solution) showed following in the output when building:
Copying file 'C:\myfilepath\resource.png' to '/home/pi/projects/myproject/resource.png'
It is possible to move the files to the final destination then with Remote Post-Build Events (mv source destination). Not the most elegant way, but the first thing I got working..
In order to include any file in the WEC7 we have to use the bib files.
In my case I created a subproject in which I wrote an application, now I want this application to be included in the run-time image. So I opened the project.bib file and wrote the following entries.
As it is an executable file, it should be in the MODULES Section
MODULES
Subproject2.exe $(_FLATRELEASEDIR)\Subproject2.exe NK
When I loaded the image on the device, I checked the Windows folder for the image, it was not present.
But when i wrote this in the FILES section
FILES
Subproject2.exe $(_FLATRELEASEDIR)\Subproject2.exe NK
It is present in the windows folder, may I know the reason?
Is it that for executables we have to keep it in the FILES section?
Or whether I'm doing anything wrong?
The MODULES section is for exe's or dll's that you may want to execute in-place, that is, without first loading them into RAM. Modules listed in this section will not be compressed in the final nk.bin image.
The FILES section on the other hand is for files that can be compressed in the image without affecting the ability to run in-place. This includes resources like bitmap images, audio and video files, and, perhaps surprisingly, also .NET exe's and dll's which are not real executables in this context (they are always loaded into memory before execution).
So generally, unmanaged/non-.NET executables should be placed in the MODULES section.
When you make changes to the .bib file be aware that, depending on the BSP, you may need to perform a platform sysgen and copy files to the release directory before generating the image.
In Platform Builder 7.0, this is done by right-clicking the Platform name in Solution Explorer and hitting Sysgen(SysgenPlatform...), followed by a trip to the Build menu and the Copy Files to Release Directory command.
You'll need to do the same if you change any .reg, .dat or .db files.
Notice that you can load the nk.bin file directly in Platform Builder to inspect its contents, files, registry entries, etc. This can potentially save some time compared to installing the image in the target. Just go through the File menu, Open, File... and navigate to the nk.bin file.
I want to include a library - I've downloaded it and found exactly four files inside:
.h
.lib
.dll
.def
I've put the header file inside of my project. That's the only thing I did - and the visual throws an error that it cannot open the .lib file.
So I immediately wanted to beg for help on stackoverflow, but I've decided to do a little research first. I've found out that the .dll file should be placed inside of the windows/SYSWOW64 location (for my 64-bit windows 7), I placed it there but VS still displays the same error.
How should I deal with that? Did I missed some step during the "installation"? If so, which ones?
You have to specify the path to the library (*.lib) in your project settings.
(You can put it also into your directory with sources)
The presence of DLL file during build is not required.
CMake uses absolute paths when it generates project files for Visual C++.
Sometimes, I need to move my project folder to some other drive.
But when I move the folder (and try to replace all the paths in the project files), this triggers a long, arduous recompilation process that wastes a lot of my time for absolutely no reason.
How do I move CMake project folder(s) to an arbitrary location without triggering a recompilation?
From the documentation of CMAKE_USE_RELATIVE_PATHS var:
In general, it is not possible to move CMake generated makefiles to a different location regardless of the value of this variable.