Eclipse with powerpc-linux-gcc possible? - linux

I program a embedded Linux on a separate target. For that I use Eclipse as a editor and the powerpc-linux-gcc.
That's a bit uncomfortable.
Is it possible to use a powerpc-linux-gcc in Eclipse?

Yes, but you want to install (via Help -> install new software -> from all available sources -> Mobile and device development) C/C++ cross compiler support and possibly C/C++ GDB hardware debugging.
When you start new project, selecet C or C++ project, then Executable, then "empty project" (or something else) and then make sure, in to selecet "Cross gcc" in right listbox. Press Next button until the page with cross compiler prefix and path shows. There you need to enter prefix (powerpc-linux- in your case) and you can also select your compiler's directory (if you have not added it to path).
When you have project set up this way, selected toolchain is used to build. You can alse set up "GDB hardware debugging" session to debug your application remotely.

Related

Configuring VC++ for WxWidgets

I am trying to follow this guide
to configure VC++ for WxWidgets. I got stuck here.
So for Core wxWidgets libraries to include, I did include wxmsw31u[d]_core.lib and wxbase31u[d].lib under Linker>>Input>>Additional Depenedencies. That is all to it right?
As for Linking with correct runtime library, can someone tell me how that is done? I manage to get here but don't know how to set the indicated settings.
Please help. I really appreciate it.
When you want to debug your app the debugger must know where in the compiled code is each function used. In jargon, the "debugging symbols". Windows puts these symbols in the compiled executable, while Linux uses another, .devfile.
When you compile code (your app or wxWidgets library) you must tell the compiler whether you want a "Debug" version or a "Release" one.
If you want the debugger to be able to step into wxWidgets code, then you must compile wxWidgets in "debug" mode, which will add the character d to the library files built. So, you must add, for example, wxmsw31ud_core.lib to your app dependencies. Notice the d between u and _. Use the file explorer to see all files generated by wxWidgets compilation process.
Perhaps you don't want all this wxWidgets "debug". Then use another wxWidgets compilation route and add wxmsw31u_core.lib instead of the d'd version. Still you can compile your own app in debug mode, but not being able to step through wxWidgets internals.
Now for your app, a) do you want a single executable file also containing wxWidgets code? or b) let your app in a .exe file which uses as needed external .dll files?
a) is called "static linkage" while b) is called "dynamic linkage"
As you can see, there are four combinations of debug/release & static/dynamic. You must choose one "runtime library" to link to your app.
The table in the wiki shows the switch and MSVC lib (select the desired combination in the 'properties' page) to use in your app; and macro definition required to build wxWidgets if you use nmake instead of the already provided configurations in VS.
Take a look at docs\msw\install.txt for more info.
The best advice I give is that you look into "minimal" sample project. Load it into VS and read every option. You can even make a copy, change some file names and use it for your own app.
I recommend using the official instructions instead of the wiki, they're simpler and, if you look at the last paragraph, you can see that you don't even have to link the libraries manually with MSVC.
You also don't need to do anything special to link with the correct version of the CRT, the defaults are just fine.

Reset Sublime build system?

I installed sublime text on a new machine, the first time I went to compile java it asked me Ant/JavaC.
I accidentally clicked Ant, is there absolutely no way to change it? It doesn't look like it's in syntax-specific or normal settings.
You can change which build system is used from the Tools menu -> Build System when the Automatic one isn't suitable, or Tools menu -> Build With to choose a different variant.
ST tracks this in the session/workspace, rather than a user facing preferences file.

How to change project type from "Cross GCC" to "Linux GCC"?

In Eclipse I've created static lib, but it seems i forgot to switch to "Linux GCC" instead of default "Cross GCC"
How to change existent project to "Linux GCC"?
Right-click on your project and select Properties. Once you're in the properties window, open C/C++ Build -> Tool Chain Editor and you'll see a dropdown box called Current toolchain, where you can select which compiler configuration you'd like to use. Select Linux GCC and you're done!

Purpose of "Target machine" field in Visual studio -> Linker-> Advanced Options->Target Machine

I'm porting a 32-bit C++ app to 64-bit (using VS2008).
I'm not sure what does this field mean in the VS2008 ::
Visual studio ->Configuration Properties-> Linker-> Advanced Options->Target Machine.
By default it's value is set to "Not set".
Is it compulsory to change it's value to "MACHINEx64" if I want my application to be ported to 64-bit executable.
Yes, this is a very important option. It sets the IMAGE_FILE_HEADER.Machine field in the executable file. The very first field of the EXE or DLL header.
Windows check this when it loads an EXE and knows whether it needs to create a 32-bit or a 64-bit process from that field. The only reason it is a the Linker + Advanced property page is because you don't normally change it. The setting is pre-selected by the project configuration you created. If you get "Not Set" then you are basically doing it wrong, hard to guess what you are doing.
Assuming you have a properly configured project that builds a working 32-bit build for your program, you create the 64-bit build with Build + Configuration Manager. In the "Active solution platform" combobox at the upper right, select <New...>. Pick "x64" in the dialog. Hopefully the other defaults (Copy settings from = Win32, Create new project platforms ticked) are correct for yours. Go back to the Linker + Advanced property page and the setting should have changed to MachineX64.
This option relates to the linker option /MACHINE and is a hint for the linker for what target architecture to link the object code if he (the linker) cannot determine this from the object file. As MSDN states you usually have not to specify this. So no you don't need to explicitly specify this flag when porting your code.

How can a Linux source package be opened as a project in an IDE?

I am makeing a small mod to SMPlayer; the Linux version...
The make, sudo make install from the command line works, but I would like to have the project in an IDE.
I want to use CodeBlocks IDE, only because I've used it before, but if some other IDE is required, I can use that instead... (I use Codeblocks because it is simple, and that suits my current ability to handle an IDE)..
Is there some way to use SMPlayer's Makefile, or some such thing?
This depends on the IDE and has little to nothing to do with Linux.
Does your program come with something like cmake or another setup tool? That normally makes it much easier. For example in KDevelop you can import straight from CMakeLists.txt and Makefiles.
If all else fails it might be quite easy to do something like this (not knowing your specific IDE):
Add new Project
Set build directory and other necessary settings (like compiler and compiler flags)
Add the already existing files to it.
Press "Compile"-button.
This is obviously depending on the project structure, setup and size.
Code::Blocks has builtin support for Makefile projects. See the FAQ.
Also you could just use vim or emacs ;)

Resources