Author Topic: Problems with resource path includes in VS2005 in simple program  (Read 10182 times)

Offline DCKelley

  • Single posting newcomer
  • *
  • Posts: 5
I am new to Code::Blocks but evaluating it for a project where we want the same IDE for VS2005~8~10 / Ubuntu, and an OMAP project, all to use GTK for the GUI as we move away from mother Microsoft.  My need is to confirm our favorite code libraries can all be used across the 3 environments.  For this Code::Blocks seems like the ideal choice.  But I cannot seem to get even a simple Window MFC example (a dialog box, text, and a button) to run under Code Blocks as yet. 

For the life of me I can’t get the resource compiler (rc.exe) to point to the include files.  [cl.exe works fine] The various global compiler settings seem valid, and the search directory tab path values are all correct.  I am running with a command line of:

rc.exe /I"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include"  -fo"Release Win32\TestApp.res" TestApp.rc

and getting back:
TestApp.rc(11) : fatal error RC1015: cannot open include file 'afxres.h'.

The file 'afxres.h' happens to be the first include in the resources file. But rc is not seeing any of the ~\VC\include directory yet.  If I move individual files to my working directory, it sees them and moves to the next one - but there must be some newbie dumb environment thing I am not doing here.   
 
This was built from the “codeblocks-10.05mingw-setup.exe” release if that might matter, running on a Win7 64 bit OS.
Any Hints?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problems with resource path includes in VS2005 in simple program
« Reply #1 on: January 23, 2012, 09:37:10 am »
rc.exe /I"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include"  -fo"Release Win32\TestApp.res" TestApp.rc

and getting back:
TestApp.rc(11) : fatal error RC1015: cannot open include file 'afxres.h'.
For me, in that folder you are including is no afxres.h (and never has been to my knowledge). So please provide the path to wherever that file is to the resource compiler.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Problems with resource path includes in VS2005 in simple program
« Reply #2 on: January 23, 2012, 09:45:22 am »
FYI: Code::Blocks has separate search settings for resource Compiler.

Tim S.
 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline DCKelley

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problems with resource path includes in VS2005 in simple program
« Reply #3 on: January 23, 2012, 12:51:27 pm »
Duh, you are right, the include file is in a folder next to it, what it really seems to need is not the Q::B default value but:
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Include
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\atlmfc\include

I should have caught that.  A few similar changes in the linker and resource compiler and we are on to the next oddity, the linker command line seems to play a bit loose with quotes and is getting confused after the output file file statement (note the bold part):

link.exe /nologo /subsystem:windows /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\atlmfc\lib\" /out:TestApp.exe  "Release Win32\TestAppDlg.obj" "Release Win32\stdafx.obj" "Release Win32\TestApp.obj"  "Release Win32\TestApp.res"  /DEBUG /INCREMENTAL:NO
LINK : fatal error LNK1181: cannot open input file 'Win32\TestAppDlg.obj Release'
Process terminated with status 1181 (0 minutes, 0 seconds)
1 errors, 0 warnings

How can I get ->> /out:TestApp.exe <<-  and not --> /out:TestApp.exe  "Release <<--  here?
 

Offline DCKelley

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problems with resource path includes in VS2005 in simple program
« Reply #4 on: January 23, 2012, 12:57:40 pm »
A bit more, I just removed the spaces in the folder names (as this has caused me countless problem in the past with path parsing), but the result is still the same.

link.exe /nologo /subsystem:windows /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\atlmfc\lib\"  /out:TestApp.exe  Debug\TestAppDlg.obj Debug\stdafx.obj Debug\TestApp.obj  Debug\TestApp.res 
LINK : warning LNK4001: no object files specified; libraries used
LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
LINK : fatal error LNK1159: no output file specified
Process terminated with status 1159 (0 minutes, 0 seconds)
1 errors, 2 warnings

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Problems with resource path includes in VS2005 in simple program
« Reply #5 on: January 23, 2012, 01:36:11 pm »
Code
/LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\atlmfc\lib\"

Likely wrong above; try removing the final "\".

Code
/LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\atlmfc\lib"

Also, rename your targets to not have a space in them if they did have one.

Tim S.
« Last Edit: January 23, 2012, 01:39:02 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline DCKelley

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problems with resource path includes in VS2005 in simple program
« Reply #6 on: January 23, 2012, 06:52:18 pm »
Quote
Likely wrong above; try removing the final "\".
That did it, many thanks, now running, now to deal with the 'missing' debugger issues....

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline DCKelley

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problems with resource path includes in VS2005 in simple program
« Reply #8 on: January 25, 2012, 02:18:04 am »
Yes, those are the right starting points (I think).  This debugger issue is a real pain, the stock MS install will not work for me (a Win 7 machine with the normal "un-pure" mix of 32 and 64 bit bits and parts). The ISO installer will quickly abort, while the smaller one will simply take much more time to do it, they seem to check for different things on start up.   That issue in and of itself may cause me to unwrap the VS2010 sitting here (as I am told that they integrated this revision of the debugger in that release).   

As of today, I can get the same simple console programs to work On Window using both GCC and the native cl tools - all very good.  And the also Unbuntu side works wells as well.   I was able to bring a huge console program with tons of graphics (produced by the tool Chart Director which is OS independent) over and get that running right away. 

Now the issue is to better control the source a bit with well chosen #ifdef pre-processor call so we can keep the same code base in two places.    Is there a help section or documentation somewhere that might address what #define would be of value when Code::Base was invoked on each environment.  I am thinking I can mix these with some OS and and environment defines and get what I need to keep a common code base. 


Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Problems with resource path includes in VS2005 in simple program
« Reply #9 on: January 25, 2012, 02:58:59 am »
If I understand you correctly, you are asking how to have Code::Blocks send a define (-DMyPlatform) for your code to pick up and (de)activate the correct sections.

I think you will find variable expansion and scripting commands useful.

What I would do is place the following line in the project build options #defines tab.
Code
[[if(PLATFORM == PLATFORM_MSW){print("Windows");}else if(PLATFORM == PLATFORM_GTK){print("GTK");}else if(PLATFORM == PLATFORM_MAC){print("Mac");}else if(PLATFORM == PLATFORM_OS2){print("OS2");}else if(PLATFORM == PLATFORM_X11){print("X11");}]]
It will evaluate to one of the strings in the print functions, which will be what is defined upon compilation.

Or the simpler method of using
Code
Platform[[print(PLATFORM);]]
in the #defines tab; picking up the resulting define possibilities of Platform0, Platform1, Platform2, ...