Author Topic: Trouble Importing & compiling vc7 project  (Read 14263 times)

Offline rossa

  • Multiple posting newcomer
  • *
  • Posts: 13
Trouble Importing & compiling vc7 project
« on: September 04, 2006, 10:10:00 am »
Hi All,

Just trying out C::B and am having prblems with a simple console app.

I get the following error after doing a rebuild. I have the include and lib directories set but I still get this error. Could it be a compiler flag problem? Compiles fine with VC2003 prof.


Simple.rc:10: fatal error RC1015: cannot open include file 'afxres.h'.
:: === Build finished: 1 errors, 1 warnings ===

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6675
    • My Best Post
Re: Trouble Importing & compiling vc7 project
« Reply #1 on: September 04, 2006, 10:42:25 am »
This happens to me when I forgot to add the directories I have under Compilier that are also needed under resouce compiler.

If a.rc includes b.h then the directory containing b.h is normally needed in the list of resouce compiler directories.

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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Trouble Importing & compiling vc7 project
« Reply #2 on: September 04, 2006, 12:52:44 pm »
In addition make sure you really have the include path's setup properly.  Thus, not only to the system (platform SDK) but also to the MFC/ATL (AFX) stuff. As an example: For the VC6 compiler you'll need [VC6]\Include , [VC6]\MFC\Include and [VC6]\ATL\Include. for the compiler settings, the linker needs [VC6]\Lib and [VC6]\MFC\Lib (assuming you would like to develop a MFC based application here).
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rossa

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Trouble Importing & compiling vc7 project
« Reply #3 on: September 05, 2006, 03:53:17 am »
Hi Guys,

I checked everything again and now I'm getting link errors:

nafxcwd.lib(appcore.obj):: error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj):: error LNK2001: unresolved external symbol ___argc
nafxcwd.lib(filelist.obj):: error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj):: error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall AfxFormatStrings(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > &,unsigned int,char const * const *,int)" ([email protected]@[email protected][email protected][email protected]@[email protected]@@@@[email protected]@[email protected])
nafxcwd.lib(viewedit.obj):: error LNK2019: unresolved external symbol __mbctype referenced in function "public: void __thiscall CEditView::ReadFromArchive(class CArchive &,unsigned int)" ([email protected]@@[email protected]@[email protected])
Simple.exe:: fatal error LNK1120: 3 unresolved externals
:: === Build finished: 6 errors, 0 warnings ===


I have this in Directories/Linker

C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\lib
C:\Program Files\Microsoft Platform SDK\Lib
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin

I cant think why the libs cannot be linked? Is there some other option/setting I'm missing?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Trouble Importing & compiling vc7 project
« Reply #4 on: September 05, 2006, 07:59:27 am »
Could you please post the full compiler log (see my sig how to enable this).
I would guess you are missing to link against very basic libraries (user32...).
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rossa

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Trouble Importing & compiling vc7 project
« Reply #5 on: September 05, 2006, 08:57:48 am »
Ok heres the full compile log.

-------------- Build: Debug|Win32 in Simple ---------------
cl.exe /nologo /MDd /Gm /Wp64 /W3 /Zi /D_DEBUG /DWIN32 /D_WINDOWS /D_DEBUG  /I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include" /I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include" /I"C:\Program Files\Microsoft Platform SDK\Include"  /c Simple.cpp /FoDebug\Simple.obj
Simple.cpp
Simple.cpp(58) : warning C4996: 'CWinApp::Enable3dControlsStatic' was declared deprecated
        C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxwin.h(4371) : see declaration of 'CWinApp::Enable3dControlsStatic'
rc.exe /I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include" /I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include" /I"C:\Program Files\Microsoft Platform SDK\Include"  -foDebug\Simple.res Simple.rc
cl.exe /nologo /MDd /Gm /Wp64 /W3 /Zi /D_DEBUG /DWIN32 /D_WINDOWS /D_DEBUG  /I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include" /I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include" /I"C:\Program Files\Microsoft Platform SDK\Include"  /c stdafx.cpp /FoDebug\stdafx.obj
stdafx.cpp
cl.exe /nologo /MDd /Gm /Wp64 /W3 /Zi /D_DEBUG /DWIN32 /D_WINDOWS /D_DEBUG  /I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include" /I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include" /I"C:\Program Files\Microsoft Platform SDK\Include"  /c MainFrm.cpp /FoDebug\MainFrm.obj
MainFrm.cpp
link.exe /nologo /LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\lib" /LIBPATH:"C:\Program Files\Microsoft Platform SDK\Lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin"  /out:Simple.exe  Debug\Simple.obj Debug\stdafx.obj Debug\MainFrm.obj  Debug\Simple.res  /DEBUG /debug
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj) : error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall AfxFormatStrings(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > &,unsigned int,char const * const *,int)" ([email protected]@[email protected][email protected][email protected]@[email protected]@@@@[email protected]@[email protected])
nafxcwd.lib(viewedit.obj) : error LNK2019: unresolved external symbol __mbctype referenced in function "public: void __thiscall CEditView::ReadFromArchive(class CArchive &,unsigned int)" ([email protected]@@[email protected]@[email protected])
Simple.exe : fatal error LNK1120: 3 unresolved externals
Process terminated with status 1120 (0 minutes, 3 seconds)
6 errors, 1 warnings


R.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Trouble Importing & compiling vc7 project
« Reply #6 on: September 05, 2006, 09:33:49 am »
link.exe /nologo /LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\lib" /LIBPATH:"C:\Program Files\Microsoft Platform SDK\Lib" /LIBPATH:"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin"  /out:Simple.exe  Debug\Simple.obj Debug\stdafx.obj Debug\MainFrm.obj  Debug\Simple.res  /DEBUG /debug
As I said: You don't link against any SDK lib. I wonder how this should work. Now unfortunately I don't know your program but you could try adding Advapi32.lib as a first step. Also please read this: http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VisualC_PLUS_PLUS_DOT_NET/Q_21018785.html
(Scroll very down to see the answers.)
With regards, Morten.

Ps.: It's really hard to resolve linker issues without knowledge of the project/libs you are using. Please notice that this is *not* a C::B issue, you should better check the dependencies yourself and/or ask in a forum related to the libs you are using.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rossa

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Trouble Importing & compiling vc7 project
« Reply #7 on: September 05, 2006, 10:30:49 am »
OK I think I've resolved the problem by adding _AFXDLL  and _MBCS as additional defines

Now my problem is debugging. If I add a break point nothing happens. All I get is

Building to ensure sources are up-to-date
Build succeeded
Selecting target: Debug|Win32
Adding source dir: D:\mds_cliq\research\Simple\
Adding source dir: D:\mds_cliq\research\Simple\
Adding file: Simple.exe
Starting debugger: done
Setting breakpoints
Debugger finished with status 1

What does this mean? I'm using gdb.exe. But to do so I had to copy the exe to the bin directory of VC7. Is this the wrong thing to do? If I didnt C::B kept complaining that there was no debugger.

Offline rossa

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Trouble Importing & compiling vc7 project
« Reply #8 on: September 05, 2006, 10:41:05 am »
Ok I found the "Additional Directories" for the debugger. But I still dont seem to be able to set break points and have it stop.

Sorry for the trivial questions but I new to C::B

R.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Trouble Importing & compiling vc7 project
« Reply #9 on: September 05, 2006, 10:46:43 am »
Go to debugger's options and enable the debugger's *debug* log. Then start a debugging session and, when it ends, copy-paste the contents of that log here.
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Trouble Importing & compiling vc7 project
« Reply #10 on: September 05, 2006, 10:54:33 am »
Ok I found the "Additional Directories" for the debugger. But I still dont seem to be able to set break points and have it stop.
If you want to debug programs compiled with the MS Visual (whatever) compiler suite you should better user cdb (the free MS command line debugger that ships with the MS debugging tools) instead of gdb. I'm not sure if I really get right what you are doing: You want to use the MS visual compiler suite with C::B, right? If not - and you try to port a MS visual application to MinGW (gcc) forget about this and use gdb.
With regards, Morten.
Ps.: mandrav: Is it possible at all to debug VC applications with gdb? I'd say no...?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Trouble Importing & compiling vc7 project
« Reply #11 on: September 05, 2006, 12:11:29 pm »
Quote
Ps.: mandrav: Is it possible at all to debug VC applications with gdb? I'd say no...?!

No.
The debug log will reveal all that and more...
Be patient!
This bug will be fixed soon...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Trouble Importing & compiling vc7 project
« Reply #12 on: September 05, 2006, 12:47:28 pm »
Quote
Ps.: mandrav: Is it possible at all to debug VC applications with gdb? I'd say no...?!
No.
Ok. I was wondering because your previous answer could have been interpreted in this way...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rossa

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Trouble Importing & compiling vc7 project
« Reply #13 on: September 05, 2006, 01:01:12 pm »
Ok heres the debug log using cdb (NB: compiling a different project but still no break at break point)

Command-line: C:\Program Files\Debugging Tools for Windows\cdb.exe -G -lines -y C:/PROGRA~1/CODEBL~1/Projetcs/test10/test1/; -srcpath C:/PROGRA~1/CODEBL~1/Projetcs/test10/test1/; ./test1.exe
Working dir : C:\Program Files\CodeBlocks\Projetcs\test10\test1\
> bc *
Microsoft (R) Windows Debugger  Version 6.6.0007.5
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: ./test1.exe
Symbol search path is: C:/PROGRA~1/CODEBL~1/Projetcs/test10/test1/
Executable search path is:
ModLoad: 00400000 0041c000   image00400000
ModLoad: 7c900000 7c9b0000   ntdll.dll
ModLoad: 7c800000 7c8f4000   C:\WINDOWS\system32\kernel32.dll
(a34.2c8): Break instruction exception - code 80000003 (first chance)
eax=00241eb4 ebx=7ffd8000 ecx=00000000 edx=00000001 esi=00241f48 edi=00241eb4
eip=7c901230 esp=0012fb20 ebp=0012fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll -
ntdll!DbgBreakPoint:
7c901230 cc              int     3
0:000> 0:000>
> bu1 `C:/PROGRA~1/CODEBL~1/Projetcs/test10/test1/main.cpp:6`
*** WARNING: Unable to verify checksum for image00400000
*** ERROR: Module load completed but symbols could not be loaded for image00400000
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\WINDOWS\system32\kernel32.dll -
0:000>
> l+t
Source options are 1:
     1/t - Step/trace by source line
0:000>
> l+s
Source options are 5:
     1/t - Step/trace by source line
     4/s - List source code at prompt
0:000>
> l+o
Source options are d:
     1/t - Step/trace by source line
     4/s - List source code at prompt
     8/o - Only show source code at prompt
0:000>
> g
Hello world!

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Trouble Importing & compiling vc7 project
« Reply #14 on: September 05, 2006, 01:40:18 pm »
Quote
*** ERROR: Module load completed but symbols could not be loaded for image00400000

Are you sure you have compiled your project with debug symbols?
Be patient!
This bug will be fixed soon...

Offline rossa

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Trouble Importing & compiling vc7 project
« Reply #15 on: September 06, 2006, 05:10:43 am »
No, I'm not sure. What do I need to do?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Trouble Importing & compiling vc7 project
« Reply #16 on: September 06, 2006, 09:01:39 am »
No, I'm not sure. What do I need to do?
Enable the compiler option "Produce debugging symbols", set additional debug defines as appropriate for your project (e.g. "MY_DEBUG") and link against debug libraries (if required).

With regards, Morten.

Ps.: Not offending, but you want to debug an application and don't know about debug compiler/linker switches... I wonder how this is going to end...?! :shock:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rossa

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Trouble Importing & compiling vc7 project
« Reply #17 on: September 06, 2006, 10:07:30 am »
Ok its working now.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2180
Re: Trouble Importing & compiling vc7 project
« Reply #18 on: September 06, 2006, 02:41:42 pm »
Quote
Ps.: Not offending, but you want to debug an application and don't know about debug compiler/linker switches... I wonder how this is going to end...?! Shocked

The same way it ended for all of us.  :)

Getting old and forgetting to turn on the debug switches just like when we were young and didn't know 'em in the first place.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Trouble Importing & compiling vc7 project
« Reply #19 on: September 06, 2006, 04:34:47 pm »
Getting old and forgetting to turn on the debug switches just like when we were young and didn't know 'em in the first place.
:lol:
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ