Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » [Tutorial] Using the Visual Studio IDE with U++
[Tutorial] Using the Visual Studio IDE with U++ [message #37554] Wed, 17 October 2012 11:25 Go to next message
crydev is currently offline  crydev
Messages: 151
Registered: October 2012
Location: Netherlands
Experienced Member
Hi there, I have been using U++ now for a few weeks. I like the library and the way of programming. However, there is one thing that I find very annoying. The packaged IDE "TheIDE". It lacks debugging features in my opinion and does not sufficiently supports me in my work with intellisense and auto-completion.

After two hours I managed to get my whole U++ application including libraries into Visual Studio 2012. It compiles, runs and now debugging is much easier to do. This topic is meant to explain to the community what I did, in case of any others having the same opinion as I have or just want to use the Visual Studio IDE anyway.

I use Visual Studio 2012, but this will probably work with 2010 and 2008 too. I'm not sure about 2005.

1. First you have to open TheIDE and compile every U++ package that you want to use in Debug mode. Make sure you have TheIDE configured with the compiler of the Visual Studio version you want to use!

2. Create a new folder somewhere where you can find it and place every output .lib file in there. With these files I mean Core.lib, CtrlLib.lib, etc.

3. Open up Visual Studio and create a new C++ Win32 project. Make it an empty project.

4. Open up the properties of the project by right-clicking on the project and clicking Properties.

5. Go to C/C++ and add the <upp directory>\uppsrc\ to the list of Additional Include Directories

6. Go to Code Generation and set Runtime Library to Multi-Threaded Debug (/MTd). Do not set it to MDD! This will generate errors.

7. Go to Linker and click General. Click Additional Library Directories to open up the list. Add the folder where you placed the compiled U++ lib files from step 2 to the list and click OK.

8. Go to Linker and click Input. Click Additional Dependencies to open up the list. Add the following libraries to the list:
- Winmm.lib
- Mpr.lib
- CtrlLib.lib
- Core.lib
- CtrlCore.lib
- bmp.lib
- png.lib
- z.lib
- Draw.lib
- RichText.lib

These libraries ofcourse are the ones my application needed. You also need to link a few Win32 libraries because the U++ libs need these.

9. Rename every .icpp file that does not compile in your project to .cpp.

10. If you are using .iml image files you need to change the include from:

#include <Folder/imlfile.iml>


to:

#include "imlfile.iml"


Try and compile your project. It should work as it did for me. There is one problem that I got by. However, if you want to use Visual Studio only for debugging this should not be a big problem. When you run your program from Visual Studio the GUI is not drawn properly. Buttons are black, borders are missing and arrayctrl headers are not drawn properly. If there are any other problems please report them.

[Updated on: Thu, 18 October 2012 11:02]

Report message to a moderator

Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37555 is a reply to message #37554] Wed, 17 October 2012 16:16 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
It is fine, except it does not solve .icpp problem.

Things like loading image in any format will not work (because image plugins will not get registered).

Mirek
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37557 is a reply to message #37555] Thu, 18 October 2012 09:29 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
would be great to offer means on how to use upp in eclipse as well.. i think Upp would be percieved as even more versatile if that were the case.

something like

"yeah, u have theide to use upp with, but if u wannt to use tool X for developping, this is how to do it best way, but be aware of drawback A, B and C"

i think proper package and assemblies management would be an additional case to consider..

i'm recently working with eclipse in work and kinda become used to it, would be a nice option to have all in one place (still enjoying development in theide though).

Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37559 is a reply to message #37554] Thu, 18 October 2012 10:58 Go to previous messageGo to next message
crydev is currently offline  crydev
Messages: 151
Registered: October 2012
Location: Netherlands
Experienced Member
Quote:

It is fine, except it does not solve .icpp problem.

Things like loading image in any format will not work (because image plugins will not get registered).


Sorry I forgot my solution to these problems. As for the .icpp files: I renamed them to .cpp and they compiled.

The image .iml files need a different include. You need to put "#include "<header>.iml" instead of "#include <folder/imlfile.iml>"

I also forgot to post a common problem with this solution which I think has to do with one of the issues you mention. When you run your program the GUI is not proper. The border are missing, buttons are black on some places and arrayctrl headers are not drawn properly.

I will add these to the OP.
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37560 is a reply to message #37559] Thu, 18 October 2012 11:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
crydev wrote on Thu, 18 October 2012 04:58

Quote:

It is fine, except it does not solve .icpp problem.

Things like loading image in any format will not work (because image plugins will not get registered).


Sorry I forgot my solution to these problems. As for the .icpp files: I renamed them to .cpp and they compiled.



But that does not solve the problem.

Please test this app:

http://www.ultimatepp.org/examples$ImageView$en-us.html

Without correct .icpp handling, it would not work, because

StreamRaster::OpenAny

will return nothing, as registration in .icpp files is not performed.

Quote:


I also forgot to post a common problem with this solution which I think has to do with one of the issues you mention. When you run your program the GUI is not proper. The border are missing, buttons are black on some places and arrayctrl headers are not drawn properly.


Yes, very likely.

The definition of .icpp files is that all global constructors in these are performed on startup. If you put those into .lib, linker will not link these files into .exe (as there are no references to the code) and thus you e.g. will not have png plugin available for StreamRaster::OpenAny.

Mirek
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37561 is a reply to message #37557] Thu, 18 October 2012 11:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
kohait00 wrote on Thu, 18 October 2012 03:29

would be great to offer means on how to use upp in eclipse as well.. i think Upp would be percieved as even more versatile if that were the case.

something like

"yeah, u have theide to use upp with, but if u wannt to use tool X for developping, this is how to do it best way, but be aware of drawback A, B and C"

i think proper package and assemblies management would be an additional case to consider..

i'm recently working with eclipse in work and kinda become used to it, would be a nice option to have all in one place (still enjoying development in theide though).




Would be great. Perhaps it would be possible to make Eclipse use .upp files and umk as plugin?

Mirek
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37562 is a reply to message #37561] Thu, 18 October 2012 12:45 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
i'll try it soon..

a good point to become familiar with eclipse Very Happy
and..android integration is waiting too..
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37563 is a reply to message #37562] Thu, 18 October 2012 20:41 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello crydev

I think yours has been a good achievement going to the right track.

It would be great that full U++ could be debugged and run from other IDEs like Eclipse and Visual Studio.

It seems that the last problem are .icpp files. Perhaps with little effort they could be handled properly from other IDEs. If not perhaps we could consider to find a way to avoid them.


Best regards
IƱaki
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37567 is a reply to message #37563] Fri, 19 October 2012 09:34 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
koldo wrote on Thu, 18 October 2012 14:41

Hello crydev

I think yours has been a good achievement going to the right track.

It would be great that full U++ could be debugged and run from other IDEs like Eclipse and Visual Studio.



It is actually possible to use Visual Studion as debugger invoked from theide (that what that "External debugger" in build methods is useful for).

Quote:


It seems that the last problem are .icpp files. Perhaps with little effort they could be handled properly from other IDEs. If not perhaps we could consider to find a way to avoid them.


We tried in the past: you can notice there are "init" files in most directories (generated by theide), in theory all you need is to include "init" files of packages that you are directly using in one .cpp file (like #include <CtrlLib/init>), which in turn will include "init" of packages they are using. If package contains ".icpp", such file gets included by its "init".

Check plugin/png/init

Anyway, this will not resolve some other issues (like .brc files), so theide cannot be compiled this way. But perhaps it is OK for most of development.

What seems even more potentially promising is using umk and providing some sort of Package organizer plugins (for Eclipse or any other similar ide)...

(That said, theide is still my preferred hammer, so hopefully somebody else will do it. I have quite low motivation here...)

Mirek
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37570 is a reply to message #37567] Fri, 19 October 2012 10:54 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
ofcorse it just makes sense to use ide to dev upp.

to include upp packages in own existing eclipse development would show the versatility of upp in a great way..

* use is as a self contained dependency free framework, building and debuggin in own the ide space

* extend your capabilities by binding your existing (VS or eclipse or wahtever) projects with upp packages.. (providing only very small glue logic / wrapper classes if at all).

* develop entirely in another IDE, but benefit from everything upp offers as source base.

since eclipse is my current dvelopment environment at work i will be persuing it slowly but steadily..

EDIT: maybe i can use doliks universal makefile generation for the purpose of eclipse building.. as a prebuild step or sth..

[Updated on: Fri, 19 October 2012 11:37]

Report message to a moderator

Re: [Tutorial] Using the Visual Studio IDE with U++ [message #37572 is a reply to message #37570] Fri, 19 October 2012 12:20 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

kohait00 wrote on Fri, 19 October 2012 10:54

EDIT: maybe i can use doliks universal makefile generation for the purpose of eclipse building.. as a prebuild step or sth..

Note that the Makefile is now generated by UppBuilder package, which allows to easily write specialized tools based on the same parser of U++ files. So if you need some special handling for eclipse plugin or something, it can probably be done rather easily Wink

Honza

[Updated on: Fri, 19 October 2012 12:21]

Report message to a moderator

Re: [Tutorial] Using the Visual Studio IDE with U++ [message #38442 is a reply to message #37554] Sat, 15 December 2012 19:11 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Honestly I prefer to use TheIde.

Having only one IDE running on all OSes U++ supports is great. And TheIde has all features I need.

Yes, it's a good effort to compile U++ on Visual Studio, but I'd rather open a package in TheIde and it builds without any path fiddling because everyone is using TheIde too.

AFAIK that's one of the problems with wxWidgets. It has too many IDEs and GUI editors but no official one.

[Updated on: Sat, 15 December 2012 19:12]

Report message to a moderator

Re: [Tutorial] Using the Visual Studio IDE with U++ [message #40881 is a reply to message #38442] Sun, 29 September 2013 23:06 Go to previous messageGo to next message
crydev is currently offline  crydev
Messages: 151
Registered: October 2012
Location: Netherlands
Experienced Member
I found the solution to the icpp problem in Visual Studio. When compiling in TheIDE, the .icpp files are passed to the compiler seperately using /Tp and linked as .obj files together with the library files.

First of all: Forget the renaming of RichImage.icpp to RichImage.cpp. The linker error you get will be solved if you follow the steps below.

To link the object files properly in Visual Studio, set TheIDE to be verbose, copy the link command in notepad and filter out all the .obj files that are not included in your own package. Copy all of these strings to 'Additional command lines options' in Visual Studio. If all went well it should work now.
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #40883 is a reply to message #40881] Mon, 30 September 2013 06:17 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

crydev wrote on Sun, 29 September 2013 23:06

To link the object files properly in Visual Studio, set TheIDE to be verbose, copy the link command in notepad and filter out all the .obj files that are not included in your own package. Copy all of these strings to 'Additional command lines options' in Visual Studio. If all went well it should work now.

Could this be automated? It seems like annoyance to manually set this up for each project, especially if it requires running TheIDE...

I'm not using Visual Studio (not even windows), but I support all attempts to make U++ work without TheIDE. To be able to use it with only a makefile, I created minimalistic .upp parser. It is written in such way that it allows adding multiple backends for various purposes, so it could perhaps be used also to automate the build process in VS. You can find the source in the svn repository. It is partialy documented, but if you have trouble understanding something, I can help. I'd try to do this myself, but I just don't have the platform to test it on. So you'll have to figure out how to make it work with VS, and I can help you generate the proper command lines Wink

Best regards,
Honza
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #41075 is a reply to message #37554] Tue, 29 October 2013 18:37 Go to previous messageGo to next message
Dsonophorus is currently offline  Dsonophorus
Messages: 4
Registered: October 2013
Location: WA
Junior Member
I'm just getting started with UPP. Here is another quick and dirty integration of UPP with visual studio. I have included the sln as an example. I use it as a template project. As with the above method, it must be linked with winmm.lib and mpr.lb from windows.

beyond that, I just copied a version of uppsrc into the directory of this project, but it can reside anywhere as long as you set your include directory to it in the project configuration.

I included all the .cpp files into a single file called core.cpp. The .icpp files I renamed as .cpp The .c file were less encapsulated so I added the .c files from the plugin/bmp, plugin/png and plugin/z directories manually.

As was noted the buttons and some borders draw black - even in the release version, so that still needs some solution.

I really like the work done on UPP. It is very clean and tight in many important ways. The "code locking" into theIde is questionable so perhaps something like this can help.
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #41079 is a reply to message #41075] Wed, 30 October 2013 07:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Wrt .icpp issue:

Has any of you have tried 'init' files yet? Those are supposed to solve the issue, these automatically generated (by theide) files reside in each package directory and include all .icpp files of package and all 'init' files of used packages (with include guards).

So instead of other .icpp tricks, it should be possible to include all init files of used packages into VS++ file with main....

Mirek
Re: [Tutorial] Using the Visual Studio IDE with U++ [message #41090 is a reply to message #41079] Wed, 30 October 2013 21:49 Go to previous messageGo to next message
Dsonophorus is currently offline  Dsonophorus
Messages: 4
Registered: October 2013
Location: WA
Junior Member
O yeah, that is cleaner than what I just did. I will probably go that route so the library isn't modified.

I redefined the MK__s token to use a macro counter instead of the apparently malfunctioning __LINE__. I then systematically (through the entire UPP library) incremented the counter everywhere MK__s was implicitly referenced - so mostly a global replace of the INITBLOCK, EXITBLOCK symbols.

In some ways it is cleaner to add a line instead of a file. If you want to get rid of the init files in a future version, feel free to rip any of my macro code you can use for that. I have more macro code when I was investigating automated class generation and type lists for templates.

Re: [Tutorial] Using the Visual Studio IDE with U++ [message #41095 is a reply to message #41090] Thu, 31 October 2013 07:36 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Dsonophorus wrote on Wed, 30 October 2013 16:49

O yeah, that is cleaner than what I just did. I will probably go that route so the library isn't modified.

I redefined the MK__s token to use a macro counter instead of the apparently malfunctioning __LINE__.



Weird, I would say, w.r.t. 'init', BLITZ_INDEX__ defines (already in init) are supposed to solve this issue....

(It is called 'BLITZ_INDEX__' because the original purpose is to make BLITZ work, but the required functionality is the same - alter MK__s for various files).

On related note, I will soon alter theide so that it can serve as file editor (if filename given on commandline). That way, it would be possible to use theide from VS (or Eclipse or anything) as external editor to edit .lay and .iml files...

Mirek
Previous Topic: Skylark timer jobs...
Next Topic: OpenGL texture issues
Goto Forum:
  


Current Time: Thu Mar 28 22:14:43 CET 2024

Total time taken to generate the page: 0.01771 seconds