Conditional compilation of resource file for different icons in visual studio C++

Combining the instruction from the post here and a blog here, I summarize the steps to dynamically use different icons in resource script file (.rc file).

1. Open your project in Visual Studio 2010
2. Right click on resource script file (e.g. app.rc) and select “Properties”
3. At the top of the property page, select one product solution configuration like “Product A” or “Product B”. This is similar to “Win32”, or “x64”, but for different product.
4. In the left menu bar, select [Configuration Properties] / [Resources] / [General].
5. In the “Preprocessor Definitions” field, add “Product_A” for “Product A” configuration and “Product_B” for “Product B” configuration . The field value will become “NDEBUG;%(PreprocessorDefinitions);Product_A”.
6. Click OK to close the window.
7. Right click on resource script file (e.g. app.rc) and select “View Code”.
8. In the code editor, add #ifdef and #elif to conditionally include resources when compiling. Use “Product_A” and “Product_B” preprocessor definitions that we defined just now.

Here is a sample code:

#ifdef Product_A
	IDI_MAINFRAME_ICON  ICON  "..\\Software\\res\\idr_main_A.ico"
#elif Product_B
	IDI_MAINFRAME_ICON  ICON  "..\\Software\\res\\idr_main_B.ico"
#else
	IDI_MAINFRAME_ICON  ICON  "..\\Software\\res\\idr_main.ico"
#endif

9. Save the resource script file and compile the project in different platforms.

nafxcwd.lib(afxglobals.obj) : error LNK2001: unresolved external symbol _IID_IWICImagingFactory

My setting:
VC2010 SP1 on Windows 7 64bit
Without any modification of the environmental variables or upgrading VC2010, I hit this error upon rebuild of an old project

nafxcwd.lib(afxglobals.obj) : error LNK2001: unresolved external symbol _IID_IWICImagingFactory

My solution:
1. At project->Properties->Configuration Properties->Linker->Input->Additional Dependencies I added windowscodecs.lib. This is a library under

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib

If you don’t have it, install Windows SDKs

2. Compile the project still hit some errors and recompile builds the project successfully

For details of discussion on this issue see here

Allow OpenVPN access LAN/Intranet behind the server (Ubuntu 14.04)

The default setting of openvpn only allows client to visit the openvpn server only. To allow the client to visit the LAN behind the server you need to forward the package from tun0 (the vpn) to wlan0 (the internet your server is using). For those who are using other interface to access internet, choose ech0, ech1, etc. accordingly.

/sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
/sbin/iptables -A FORWARD -i wlan0 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i tun0 -o wlan0 -j ACCEPT