Compile .mm files in Eclipse CDT (os x) - eclipse-cdt

I have imported an xcode project into Eclipse CDT, which contains myfile.h and myfile.mm pairs. It seems, however, that *.mm files are ignored in the build, as I am getting "Undefined symbols" error for the classes implemented in the *.mm files.
How can I tell Eclipse CDT that for a given .h file it should compile .mm file too?
Thanks.

Ah, great question. Unfortunately the CDT currently doesn't have support for Objective-C files. There has been some discussion about that and hopefully we'll see more activity in the coming months. For now you would have to create your own Makefiles or use CMake to build from the xcodeproj file.

Related

Eclipse CDT indexer different results for C file than C++ file

I'm using Eclipse 2018-12 with latest CDT. Getting odd indexing problems with the Editor. Given the below. If the source file has a ".c" extension the indexer complains that type "bool" and "false" cannot be resolved. If the file has a "*.cpp" extension the type is resolved.
In both cases, the project will build and can be debugged.
Not sure if it matters, but I'm using CMake 3.13 to generate Eclipse Project files, although I have tried to manually adjust project settings to no avail.
#include <stdbool.h>
void main(void)
{
bool success = false;
}
I have a C Project, but my unit testing is using GTest and are the only .cpp files in the project. All .c files exhibit this behavior.
Found a similar post in an Eclipse forum. Consensus was this might be a Bug in the indexer/editor code.
However there was a workaround solution. It you have a Project with both .c and .cpp files in the project Properties -> C/C++ General -> Language Mappings, add a mapping for "C Source File" to the "GNU C++" Language.
Since my build files are being generated by CMake I don't believe this will impact the way Eclipse Builds/Debugs my code.
I agree that this is a bug in Eclipse CDT, which I've filed in its bug tracker.

Tesseract in Xcode C++ project

I installed tesseract on my mac and i have the libtesseract.3.dylib and libtesseract.a.I added these files to the C++ command line project and added the header # include or just #include "baseapi.h". It is throwing errors in both the cases. The error is file not found in the former and some other library files are missing in the latter.I added all the header files in the xcode but still it is difficult.Can someone please tell how to include tesseract in Xcode and work with it?

Code:Blocks c++ precompiled header linker errors

I've just transferred a vc++ project over to code::blocks on linux, using the g++ compiler, as that's the target platform, and it's refusing to compile.
I'm getting errors like:
g++: error: inc/BarcodeServer.h.gch/Debug_inc_BarcodeServer_h_gch: No such file or directory
Firstly, I don't want to use pre-compiled headers anyway, so I have no idea why it's looking for .gch files. I just want to use standard .h headers.
Secondly, the file names it's looking for seem bizzare, like it's looking for a directory inside a file, though this could just my unfamiliarity with g++.
I'm not really sure what steps I need to take in Code::Blocks to have it simply use the .h files to compile. I've looked around, and in the build options there's a "precompiled header strategy" but none of the options are just "don't use them"
Any help would be appreciated.

Can I compile a Visual C++ project on Linux using xbuild?

I have an existing project that I compile on both Windows using Visual C++ 2008, and Debian Linux. This project uses a standard Visual C++ .vcproj file, and some .cpp and .h files. It does not rely on any Windows specific stuff. Just plain C++.
It compiles and run well on Linux, using a home made tool that reads the .vcproj file to generate a Makefile which is used with make to compile and link all files using g++.
The trouble is that with Visual C++ 2010 (and 2012), the format of the project files have changed. Even the name has been changed from .vcproj to .vcxproj. My home made tool cannot read this new project file to generate the Makefile.
Instead of upgrading the home made tool to support new project files, I was wondering if xbuild would be able to compile my Linux executable?
I tried first to compile my own (VC++2008) project, but xbuild complains that my project is a VS2003 project, which is not supported by xbuild. However when googling on this matter, I find that xbuild is supposed to support VS2005 project files. There are also some references to mdtool to support these old project files, but I seems to be integrated into xbuild now.
Furthermore, I tried to compile a Visual C++ 2010 example (HuoChess) got from the MSDN site. The result is
/Microsoft.Cpp.Default.props: Project file could not be imported, it was being
imported by [...] /HuoChessConsole/HuoChessConsole.vcxproj: Imported project:
"//Microsoft.Cpp.Default.props" does not exist.`
Now, this looks like the project file wants some Microsoft definitions of rules for the Cpp compiler. Should I fake these definitions to use gcc instead? How can I do this?
Is what I want to do ever possible with xbuild?
There is a project GCCBuild which you can use to build vcxproj projects in Linux. It simply uses same vcxproj but uses GCC to compile and build. There are multiple examples there too.
PS. I am the author of that project.

Build C++ Projects with Makefile using Visual Studio 2008

I downloaded cpptest from internet, and I want to build it using Visual Studio 2008.
The problem is that instead of .sln and vcproj file, Makefile.am is distributed, and I believe that all the all the necessary included file is included in the Makefile.am.
How to use Makefile.am to generate VS project files? I tried to use Cmake, but there is no CMakeList in the distribution.
Edit: Thanks to all the answers! There is a sln file distributed after all. But I am still interested to know the answer to my original question.
the visual studio project files for cpptest are in the win directory, not in the src directory where the makefile is..
edit
makefiles are meant to be used with GNU make. If you want that on windows, you can look at Mingw, GnuWin32 or Cygwin. But they also require gcc for compiling, so you won't really be using VS.
However, for most projects that do not have external dependencies it's no big deal if you do not have the VS project file: after all a makefile is just a list of the source files and some compilation options. To successfully build projects like cpptest, you could just create an emtpy VS project, add all source files to it, set output type to executable, build it and you're done. Eventually you can tune optimization options, but for the rest the default options will just do fine.
Go to win\VisualStudio.NET and you will find a VS solution file.
I just downloaded the archive and found the .sln file. It is under: /win/VisualStudio.NET. You can open that with VS2008 and update it, it should work.