AutoHotkey Community

It is currently May 25th, 2012, 4:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 91 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Author Message
PostPosted: May 12th, 2007, 10:36 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2539
Here's a list of instructions that I have pieced together based on installing Microsoft Visual C++ 2005 Express Edition and using it to compile AutoHotkey on XP Pro SP2 and Vista Home Premium). Note: The files in the steps listed were from an XP Pro SP2 installation. Other Win versions may have different downloads (Vista does). Please check the system requirements for the downloads if you are not sure.

If you had previously gone through the steps to get Microsoft Visual C++ 2005 Express Edition installed and don't want to through the steps listed below to manually make the necessary modifications then you can download modified sln and vcproj files for version 1.0.46.16 in a zip file. After downloading and extracting the AutoHotkey source files, extract the 2 files in the zip file, replace the 2 existing project files and open the sln file in VC++. The conversion wizard will still start but after completing the wizard (and copying upx.exe to the source directory if necessary) AutoHotkey should compile ok. If anyone decides to try this method then please let me know if it works ok for you.

Modified sln and vcproj files for version:
1.0.47.01
1.0.46.17
1.0.46.16


Install and configure Microsoft Visual C++ 2005 Express Edition

Download and install - Visual C++ 2005 Express Edition (install the IDE if asked)
http://msdn.microsoft.com/vstudio/express/downloads/

Download and install - Microsoft ® Windows Server® 2003 R2 Platform SDK Web Install
http://www.microsoft.com/downloads/deta ... laylang=en

Download and install - Microsoft® Visual Studio® 2005 Express Editions Service Pack 1
http://www.microsoft.com/downloads/deta ... laylang=en

Important: go to http://msdn.microsoft.com/vstudio/expre ... usingpsdk/ and follow the directions in Step 4 to update the corewin_express.vsprops file.

Open Visual C++ and go to Tools->Options->Projects and Solutions->VC++ Directories
On the right there will be a list of paths. There is also a drop-down list on the top right (Show directories for:)
Make sure to fill in the correct paths for the paths for the Executable files, Include files, and Library files sections. To change a path, double click the path in the list then click ... on the right to navigate to the path requested. When finished entering the paths, click Ok

Here's an example of what the modifed sections might look like:
Image
Image
Image

Load, Configure and Compile AutoHotkey Source

Go to http://www.autohotkey.com/download/ and download the latest AutoHotkey source code (note: version 1.0.46.15 was used in this example)

Run the downloaded file and unzip the project into a new folder in your /My Documents/Visual Studio 2005/Projects/ folder
(example: C:\My Documents\Visual Studio 2005\Projects\ahksrc104615)

Go to File->Open->Project/Solution... in VC++ then browse and open the AutoHotkey.sln file in the source folder where the AutoHotkey source was extracted. That will start a Conversion wizard. Click Next to proceed and convert the project. Since I still have the original from the download, I chose no when asked if I wanted to create a backup. Once the project has finished converting, a report can optionally be displayed. AutoHotkey.sln should show that it was converted successfully and the AutoHotkey and lib_pcre Projects should have a list of conversion issues.

In the Solution Explorer pane (on the left in the IDE), browse to the file stdafx.h and double-click on it to open the file in the right pane
on the line below the existing line
Code:
#define WIN32_LEAN_AND_MEAN
add the following line:
Code:
#define _CRT_SECURE_NO_DEPRECATE
then save the file (use the save icon at the top left - 4th from the left - in the IDE).

In the file menu:
Navigate to Build->Configuration Manager and change the Active solution configuration to Release using the drop-down list provided then click close


Next, Navigate to Project->AutoHotkey Properties...

Under Configuration Properties->C/C++->Precompiled Headers
change Create/Use Precompiled Header to say Create Precompiled Header (/Yc)

Under Configuration Properties->C/C++->General
change Treat Warnings As Errors to NO

Under Configuration Properties->C/C++->Advanced
change Omit Default Library Names to Yes(/ZI)

Under Configuration Properties->C/C++->Advanced
change Calling Convention to something else then change it back to _cdecl(/Gd)

Under Configuration Properties->Linker->Input
remove LibCMT; from the Ignore Specific Library line

Under Configuration Properties->Linker->Optimization
change Link Time Code Generation to Use Link Time Code Generation (/ltcg)

(note: these settings will likely need to be changed for each solution configuration - Debug Release, SC, etc... if you change to use a different Active solution configuration later)

Open Notepad and edit the file AutoHotkey.rc in the /source/resources/ folder in the AutoHotkey source directory. Look for the line
Code:
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST             "AutoHotkey.exe.manifest"

and change it to
Code:
 // CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST             "AutoHotkey.exe.manifest"

then save the file and close Notepad.

In the Solution Explorer pane on the left in the IDE in the /Source Files folder, browse to script_autoit.cpp and double-click to open it in the right pane. In the file menu: navigate to Edit->Go To... then type in 1785 for the line number and click Ok. Change line 1785 from
Code:
lpTemp = strchr(szDest, '*');

to
Code:
lpTemp = (char*)strchr(szDest, '*');

then save the file (use the icon at top in the IDE...)

Go to http://upx.sourceforge.net/ , download the win32 console version of UPX version 3.00 , then extract upx.exe to the AutoHotkey source folder
(to the same folder as AutoHotkey.sln) or to a system path.

Finally, in the file menu of the IDE, navigate to Build->Build Solution (or to Build->Rebuild Solution if you had preiously attempted to build AutoHotkey) and compile AutoHotkey

If all goes well the end of the output should be similar to:
Quote:
Finished pass 2
Embedding manifest...
Performing Post-Build Event...
Ultimate Packer for eXecutables
Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
UPX 3.00w Markus Oberhumer, Laszlo Molnar & John Reiser Apr 27th 2007
File size Ratio Format Name
-------------------- ------ ----------- -----------
536576 -> 254464 47.42% win32/pe AutoHotkey.exe
Packed 1 file.
Build log was saved at "file://c:\My Documents\Visual Studio 2005\Projects\ahksrc104615\Release\BuildLog.htm"
AutoHotkey - 0 error(s), 16 warning(s)
========== Rebuild All: 2 succeeded, 0 failed, 0 skipped ==========


If everything went ok, the compiled file will be in the /Release folder in the Project directory (example: C:\My Documents\Visual Studio 2005\Projects\ahksrc104615\Release)

If AutoHotkey doesn't compile ok then I may have missed adding a step or two in the steps above. Please let me know if that seems to be the case and/or if something needs clarification so that I can update this post.

If you're having difficulties or have questions then feel free to ask.

Thanks. Enjoy :)

Edit: corrected typo: stafx.h should have been stdafx.h


Last edited by corrupt on July 12th, 2007, 1:09 pm, edited 5 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2007, 10:51 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Thanks for putting all this together. Finally there's a free compiler that doesn't require a major overhaul of the AutoHotkey source.

I've moved this topic from "General Chat" to "Scripts" because it seems more appropriate here.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 12th, 2007, 11:13 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2539
Thanks Chris :) . I wasn't sure where to post this. Also, thanks for the tips in getting things to compile. Now it's time to play... :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2007, 12:19 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2539
An alternate method to using Notepad to comment out the manifest line in the AutoHotkey.rc file is to change the Project Options instead. To make the change:

In the file menu in the IDE navigate to Project->Properties then to Configuration Properties->Linker->Manifest File then change Generate Manifest to No

This change will also reduce the exe size slightly (from 254464 to 251904).

output from Build wrote:
adding resource. type:MANIFEST, name:1, language:0x0409, flags:0x30, size:545


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2007, 8:17 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Thanks corrupt for this comprehensive wrap up. Now I only have to learn C/C++ :) (fixed two small typos in your posts.)

I hope that this will lower the barrier for people who know C/C++ to help and add development time to AHK.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 13th, 2007, 8:27 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Great, it was a long awaited capability.
I will try as soon as I can.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2007, 2:43 pm 
Offline

Joined: April 19th, 2006, 1:02 pm
Posts: 386
Sticky? :roll:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 14th, 2007, 3:46 pm 
foom wrote:
Sticky? :roll:
I doubt it will interest many AHK users... :-)
But this surely should be linked from somewhere in the site (perhaps next the download source code link, or just in some ReadMe.txt in the download file).


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2007, 3:30 pm 
Offline

Joined: April 19th, 2006, 1:02 pm
Posts: 386
The users? Who cares about the users? Its about attracting developers to have a look on ahk and maybe help Chris develop AHK (if this is in his interesst).

@Chris:
If someone would create a working copy for gcc would you be willing to change the source so that its gcc compatible "out of the box" ?

Edit: Ohh and is there any place i can talk to you in realtime like irc or im?


Last edited by foom on May 15th, 2007, 5:11 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2007, 3:33 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
foom wrote:
The users , the users? Who cares about the users? Its about attracting developers to have a look on ahk and maybe help Chris with developing.

Oh, FINALY somebody sane here. Gratz foom about deduction.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 15th, 2007, 4:19 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
corrupt wrote:
Important: go to http://msdn.microsoft.com/vstudio/expre ... usingpsdk/ and follow the directions in Step 4 to update the corewin_express.vsprops file.

Aargh, I just see this after trying to compile SciTE with VS 2005 and discovering via Google bribes of the steps described in the above link...
Don't follow only the Step 4, but all the steps (well, you gave the first two in your excellent article).

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 15th, 2007, 5:43 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Grumpy, thanks for the suggestion. In the next release of the source code, I'll include a file "How to compile.txt":
Code:
AutoHotkey is developed and compiled on Microsoft Visual C++ 2003 (7.1).

However, it is also known to compile on:
Microsoft Visual C++ 2005 (8.x): Requires a few modifications to project settings.
Microsoft Visual C++ 2005 Express (a free compiler): For detailed instructions,
see http://www.autohotkey.com/forum/topic19154.html
Corrupt: To make things even easier for people, perhaps you can provide a ready-made solution/project file for Visual C++ Express. On the other hand, maybe it would just get out-of-date too quickly and be too much work for you to keep up-to-date.

foom wrote:
If someone would create a working copy for gcc would you be willing to change the source so that its gcc compatible "out of the box" ?
It depends on the nature and extent of the changes (when I last checked a couple years ago, it seemed likely that the changes would be extensive). Also, I'd be against any changes that increase the size of AutoHotkey.exe or reduce its performance.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: May 16th, 2007, 3:16 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2539
PhiLho wrote:
Don't follow only the Step 4, but all the steps (well, you gave the first two in your excellent article).
Thanks :) . I gave instructions for step 3 also (with images ;) ) but does it seem like it might be better to suggest modifying the VCProjectEngine.dll.express.config file instead? I haven't tried that method yet.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 3:56 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2539
Chris wrote:
Corrupt: To make things even easier for people, perhaps you can provide a ready-made solution/project file for Visual C++ Express. On the other hand, maybe it would just get out-of-date too quickly and be too much work for you to keep up-to-date.
I don't mind since I'll likely try and keep up to date anyway but I might end up lagging behind the official release once in a while.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 10:27 am 
Offline

Joined: April 19th, 2006, 1:02 pm
Posts: 386
Chris wrote:
It depends on the nature and extent of the changes (when I last checked a couple years ago, it seemed likely that the changes would be extensive). Also, I'd be against any changes that increase the size of AutoHotkey.exe or reduce its performance.


by uncommenting #ifdef _MSC_VER from stdafx.h i get the error count down to 13 (missing definitions/declarations).

Code:
D:\DESKTOP\AutoHotkey104615_source\source\clipboard.h:71: error: invalid conversion from `const char*' to `char*'
D:\DESKTOP\AutoHotkey104615_source\source\clipboard.h:74: error: invalid conversion from `const char*' to `char*'
D:\DESKTOP\AutoHotkey104615_source\source\util.h:53: warning: cast to pointer from integer of different size
D:\DESKTOP\AutoHotkey104615_source\source\util.h:53: warning: cast from pointer to integer of different size
D:\DESKTOP\AutoHotkey104615_source\source\util.h:57: warning: cast to pointer from integer of different size
D:\DESKTOP\AutoHotkey104615_source\source\util.h:57: warning: cast from pointer to integer of different size
D:\DESKTOP\AutoHotkey104615_source\source\util.h:60: error: `isspace' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\util.h:180: warning: comparison between signed and unsigned integer expressions
D:\DESKTOP\AutoHotkey104615_source\source\util.h:203: warning: comparison between signed and unsigned integer expressions
D:\DESKTOP\AutoHotkey104615_source\source\util.h:236: warning: comparison between signed and unsigned integer expressions
D:\DESKTOP\AutoHotkey104615_source\source\util.h:313: error: `isxdigit' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\util.h:339: error: `_strtoi64' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\util.h:344: error: `_strtoui64' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\util.h:373: error: `_strtoi64' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\script.h:247: error: `LPPICTURE' does not name a type
D:\DESKTOP\AutoHotkey104615_source\source\script.h:353: warning: converting of negative value `-0x000000002' to `DWORD'
D:\DESKTOP\AutoHotkey104615_source\source\script.h:1183: error: `MIXERCONTROL_CONTROLTYPE_BASS_BOOST' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\script.h:1351: error: `isdigit' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\script.h:1638: error: `IDCONTINUE' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\script.h:1639: error: `IDTRYAGAIN' was not declared in this scope
D:\DESKTOP\AutoHotkey104615_source\source\script.h:2148: warning: converting of negative value `-0x000000001' to `GuiIndexType'
D:\DESKTOP\AutoHotkey104615_source\source\script.h:2270: warning: extra tokens at end of #endif directive
D:\DESKTOP\AutoHotkey104615_source\source\AutoHotkey.cpp:40: warning: converting of negative value `-0x000000001' to `size_t'
:: === Build finished: 12 errors, 11 warnings ===

for the *toi64 functions and maybe the other ones some on a mailing list mentioned that its missing in the headers but he can declare it in its app and link it against the appropriate library.
quote from : http://osdir.com/ml/gnu.mingw.announce/ ... 00019.html
Quote:
_strtoi64() is missing in stdlib.h and libmsvcrt.a but
it is present in msvcrt.dll (works if I declare it in
my app and link against msvcrt.dll).


As for the speed/size tradeoff against msvc we have to see when its done ;).

Edit: Ohh i forgot to mention that i had to replace all occurences of __forceinline with inline since gcc ain't happy about that.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 91 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], ecksphore, Exabot [Bot], mrhobbeys, zeus19 and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group