I am getting the following linker error in my project.
Error: Unable to open file 'FOO.DFM'
I am compiling with the old borland compiler (not clang) and building using cmake rather than the IDE. I have added the directory of the dfm file to target_include_directories. Compilation is successful but having this issue with multiple dfm files at the linking stage.
In the .cbproj file of the ide this is used like the following way:
</CppCompile>
<FormResources Include="foo.dfm"/>
UPDATE:
I'm wondering is this because the delphi compiling isn't occurring through cmake (dcc32). Is this supported or do you need to have a custom add_custom_command in your cmake to handle this. C++ Builder docs doesn't seem to mention any delphi compilation.
In the IDE build output one of the initial tasks is the delphi compilation, you can see c:\program files (x86)\embarcadero\studio\20.0\bin\dcc32.exe -B but this is not happening in cmake output
Related
Who creates .qmake.stash file? When is it created?
I've been working with Qt in Visual Studio creating Windows applications for some years now but never had to care about this file. But now I have set up a cross compilation in Visual Studio using WSL 1 in order to build my application for Linux on arm64.
I'm able to build all projects in my VS solution on my development computer. Now I'm trying to setup this cross compilation system on another PC. The first project of this solution could be built without a problem, but the second one failed with
error : qmake: Project ERROR: Cannot run compiler 'aarch64....'
error : qmake: Maybe you forgot to setup the environment?
error : qmake: Error creating Makefile
After many hours of investigation comparing project files and configurations I was able to find the reason: qmake didn't find the file .qmake.stash when it should create the Makefile.
The working project has a .qmake.stash file in the intermediate output path $(IntDir) /obj//<vs_configuration>, e.g. myproject/obj/x64/RelArm64.
The failing project doesn't have this file in its $(IntDir).
If I manually copy this file from the working project to the other project, it works, too.
Who should have placed this file to $(IntDir) before executing qmake?
My qmake.stash file in the working project is quite old. So it seems as if it isn't generated during every build process.
I am new to C++ and wxWidgets. During the last couple of days, I have followed a tutorial with Visual Studio into how to build wxWidgets desktop applications (https://www.youtube.com/watch?v=FOIbK4bJKS8&t=800s).
Now, because I am not familiar with Visual Studio, I wanted to move to edit the code with Atom and compile with MinGW from Windows command prompt.
The app has the following files:
cMake.h
AnalogRead.h
cMake.cpp
AnalogRead.cpp
In Visual Studio, you need to include two directories and one library in the project, which are the following:
Paths:
/wxWidgets/include
/wxWidgets/include/msvc
Libraries:
/wxWidgets/lib/vc_lib
Relative to the path where the the C++ code is.
So I have tried to create the compile line, without success:
c++ -I/wxWidgets/include -I/wxWidgets/include/msvc -L/wxWidgets/lib/vc_lib cMake.cpp AnalogRead.cpp -o test
But I get the following error:
In file included from AnalogRead.cpp:1:0:
AnalogRead.h:3:19: fatal error: wx/wx.h: No such file or directory
#include <wx/wx.h>
^
compilation terminated.
The thing is, I am including that path in the compilation. wx/wx.h is inside the path /wxWidgets/include/.
Is there a way to fix this? Thanks in advance.
You can't compile the library with one compiler and then compile the application using it with another, this is just not going to work. You should decide which compiler you want to use (or maybe try using both of them, but not both at the same time!) and follow the official build instructions in the file docs/msw/install.md.
/wxWidgets/include is not a relative path. This is an absolute path in the current disk. Do you have C:\wxWidgets\include? Try -IwxWidgets/include or -I./wxWidgets/include, without the leading /. This path should work if you have the wxWidgets directory in your app sources.
If you want to use MinGW, you need to build the library with MinGW compiler and then use EXACTLY THE SAME command to buid your software.
Or use an IDE (CodeBlocks, CodeLite).
HTH.
I am using a newly installed Visual Studio 2019 for a cmake project. The Intellisense for code completion (i.e. function and constant names) works fine. However, the red underlining syntax errors (i.e. missing semicolon, wrong param type, undefined variable) are missing from the text editor.
I set IntelliSense mode to windows-msvc-x64 in CMakeSettings.json and used Ninja as default cmake generator.
How do I enable real-time syntax error detection in a cmake project? Is this possible at all?
How do I enable real-time syntax error detection in a cmake project?
Is this possible at all?
Please check if you get the No Configurations tip for the xx.cpp where the Intellisense is not supported.
For Cmake projects in VS, when you create or add a new xx.cpp file to current project, you need to define the source file in CMakeLists.txt and then regenerate the Cmake cache, After that the Intellisense can support all functions for the xx.cpp file.
Workaround:
So for your issue, assuming you have created a new Test.cpp file in the project, first you should make sure the Test.cpp file is defined in the first CMakeLists.txt file, then switch to the target view to check if the Test.cpp file is under the ProjectName(executable) level. If you can't find Test.cpp in ProjectName(executable) level like this:
Right-click the project=>generate cache and if it succeeds, you'll find the Test.cpp under ProjectName(executable). And only when you can find the xx.cpp under the ProjectName(executable), all code in the xx.cpp can get full support of Intellisense(i.e. missing semicolon).
I wanted to convert my simulation code in Matlab to C++ and run it with a C++ compiler such as Visual Studio or g++. I modified my code to successfully build a C++ project using Matlab Coder.
The coder returns a .prj file in the top project directory, and tens or hundreds of c++ source/header/object files in the dll directory. I tried to open the .prj files with Visual Studio 2012 or 2013 (I tried with both versions) that was unsuccessful and they cannot even open a .prj file.
I have made sure to configure the Visual Studio as the C++ language compiler in Matlab using mex -setup.
Does anyone have any idea how to handle the .prj and the subsequent files with Visual Studio or g++? I don't want to make it executable at the moment; I just want to run it with either compilers and make sure it's working.
Thanks
The prj file that is generated is used for the MATLAB Coder GUI, rather than Visual Studio. If you double-click that file in MATLAB, the Coder GUI will open and you can generate code using it.
For a simple example of using the generated code in Visual Studio you can refer to the documentation.
If you are going to use the generated code on the same platform on which you are running MATLAB, I would recommend changing the output type to a static library (LIB) or a shared library (DLL). Doing so will cause the C or C++ code to be generated and then compiled into a library using the compiler that you specified. Then you can write code that calls the functions declared in the generated header file(s) and link in the generated library when compiling your hand-written code.
For Visual Studio, you'll need to add the codegen directory, codegen/lib/<proj_name> to the include path and add the generated LIB/DLL file as a dependency. With GCC, you'll need to add the same directory to the include path when compiling your code and link in the library.
The second half of my other answer has more information in it.
Alternatively, if you have a C main function written, you can set the output type to EXE and specify the main function to have MATLAB Coder generate code, compile it with your provided main and compile a standalone executable.
Does anyone have any idea how to handle the .prj
you supposed to run "mcc" on .prj file, I believe
Quote
"Specify that mcc use settings contained in the specified project file. Use
-F project_name.prj
to specify project_name as the project file name when calling mcc. This option enables the .prj file, along with all of its associated settings, to be fed back to mcc. Project files created using either mcc or deploytool are eligible to use this option. When using -F, no other arguments may be invoked against mcc."
I try to build a book samples. (http://www.apress.com/9781430258308 , full source code can be download from there. I tried to build the very first code.)
I downloaded and installed the latest android sdk,adt and eclipse. I installed Sequoyah in Eclipse. I use android NDK r8c instead of the latest NDK because I got an 'Invalid path for NDK' error when I tried to set the NDK path in Eclipse.(Preferences/Android/Native Development/NDK Location)
I use MiniGW for c++ compiler.(I used this guide ( http://riccardotramma.com/2011/04/setup-eclipse-to-develop-opengl-glut-apps-in-java-cc-on-windows-mac/ ) to setup MiniGW in Eclipse. Just the MiniGW part.) I use MiniGW instead of Cygwin because I always get a 'unexpected end of file' error at some point of the build process.
I also added some include path and library (java and opengles) to the project at Properties/C/C++ General/Paths and Symbols. If I don't do this I get a 'fatal error: jni.h: No such file or directory' error and I would get additional errors for the further .h declarations.(egl.h etc.)
Now I just get the 'fatal error: android/sensor.h: No such file or directory' error (this is the first android .h declaration and probably I would get more errors for all of the android specific .h files later in the code.
I noticed one thing. There is a red x near $(call import-module,android/native_app_glue) line in the Outline window. Everything else seems fine.
If you can successfully build the above examples ( you can download it freely) please let me know your exact configuration or please guide me how to build my first native opengl code. (sdk,ndk versions etc.)
Thanks in advance,
Steve
Here's some quick points:
You can't use MinGW as the C++ compiler to work on Android NDK projects. The Android NDK has it's own specific compiler/toolchain. If you right-click on your project in Eclipse and go to C/C++ Build > Tool Chain Editor. The current toolchain should be Android GCC.
If you are getting unexpected end of file errors, could it be that some of the code has unix/linux style line endings? Here is an example of that (with the solution of using a text editor to make sure all the end lines are Windows/DOS format) - http://connect.microsoft.com/VisualStudio/feedback/details/794991/c-error-directive-and-unix-line-endings-leads-to-an-unexpected-end-of-file
You need a Application.mk file in the same directory as Android.mk.
This Application.mk file should contain a string similar to APP_PLATFORM: = android-9.