Re: C++/TCL Need Solution to Compile Error c2784



On Apr 17, 7:49 pm, David Gravereaux <davyg...@xxxxxxxxx> wrote:
JesusChuyCam...@xxxxxxxxx wrote:
David,

I got one more question. Do I have to tell the compiler to load the
jnior.dll or does it have to be part of the source code.

It needs to be part of the link. That's what the .lib file is for.

Here are the
error messages that I'm getting. What compiler are you using?

MSVC++ 6 (an oldie, but works for me)

error04.txt
===================================== START
jnior310tcl2.c
c:\program files\tcl_tk\tcl_c_api2\jnior_300.h(19) : warning C4031:
second formal parameter list longer than the first list
c:\program files\tcl_tk\tcl_c_api2\jnior_300.h(19) : warning C4028:
formal parameter 1 different from declaration
c:\program files\tcl_tk\tcl_c_api2\jnior_300.h(19) : warning C4142:
benign redefinition of type
c:\program files\tcl_tk\tcl_c_api2\jnior_300.h(19) : warning C4273:
'GetVersion' : inconsistent dll linkage
C:\Program Files\Microsoft Visual Studio\VC98\include
\winbase.h(1116) : see previous definition of 'GetVersion'

^-- All problems with the jnior header file's definition of GetVersion(). The
same function name is exported by windows, too. You could get around it by using
C++ namespaces like so:

namespace jnior {
# include "jnior_300.h"

}

Then the function would be jnior::GetVersion() and wouldn't clash. All other
jnior functions and types would be in that namespace as well. How the linker
would resolve that, I'm not sure off-hand.

Creating library jniortcl2.lib and object jniortcl2.exp
jnior310tcl2.obj : error LNK2019: unresolved external symbol
_Connect@20 referenced in function _ConnectCmd
jnior310tcl2.obj : error LNK2019: unresolved external symbol
_Disconnect@4 referenced in function _DisconnectCmd
jniortcl2.dll : fatal error LNK1120: 2 unresolved externals
===================================== STOP

Make sure jnior300.lib is in your list of libraries you link to and the path to
find it is there too.

I guess my biggest problem is with the compiler. I got IT to re-
installed MS Visual Studio 6 (because we have a spare license), and
that just gave me more problems, and I then had IT re-installed MS VC+
+ 2005 "Express Edition", since it has a 30 day trial, but it is
missing the "window.h", so now I'm trying to link libraries from both
compilers.

-JC

Cross-pollinating compilers voids your warranty ;) Just joking, should work fine.
There's always the "Platform SDK" from MSDN if you need the window.h stuff, but
it's rather a big download as I remember.

About you only get using an IDE environment is the ability to step-debug your
application, which may or may not be needed for your project. I like free
compilers, myself.. there's nothing wrong with them.

--
"But the important thing is persistence." -Calvin trying to juggle eggs

signature.asc
1KDownload

Right after my last post, I looked through the groups and learned that
the error message: "error LNK2019: unresolved external symbol ..." is
due to the lack of the "SDK Files" (which is why windows.h was not
included). I verified other post and it appears that it comes down to
that I really need these files. Specifically:
User32.Lib
Gdi32.Lib
WinSpool.Lib
ComDlg32.Lib
AdvAPI32.Lib
Shell32.Lib
Ole32.Lib
OleAut32.Lib
Uuid.Lib

I had to download the SDK and followed the instructions from here:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx

I ran the test and things worked out as expected.

Since I'm using the Command Prompt rather than the GUI to compile the
code, I had to create a .bat file to set the Environment.

add_sdk_paths.bat
================== START
echo Adding SDK paths

@set PATH=C:\Program Files\Microsoft Platform SDK for Windows Server
2003 R2\Bin;%PATH%
@set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows
Server 2003 R2\Include;%INCLUDE%
@set LIB=C:\Program Files\Microsoft Platform SDK for Windows Server
2003 R2\Lib;%LIB%
================== STOP

Once I execute the Visual Studio 2005 Command Prompt, I execute
the .bat file and verify my paths
dosPrompt> echo %PATH%

I then tried to compile your source code and I kept getting the same
errors. I then tried my source code, with the corrections you
provided and I only get the "error LNK2019: unresolved external
symbol....." error message.

BTW: I did tried to add "namespace jnior { #include "integpg/
jnior_300.h" }" and created other errors where it didn't even compile.
Error Message:
jnior310tcl2.c
jnior310tcl2.c(4) : error C2061: syntax error : identifier 'jnior'
jnior310tcl2.c(4) : error C2059: syntax error : ';'
jnior310tcl2.c(4) : error C2449: found '{' at file scope (missing
function header?)
jnior310tcl2.c(4) : error C2014: preprocessor command must start as
first nonwhite space
jnior310tcl2.c(121) : fatal error C1004: unexpected end-of-file found


Any ways; here is the cl command used and the error message

using your source code, compile command:
cl -nologo -MD -I"C:/Program Files/Tcl/include" jnior310tcl2.c -link -
dll -out:jnior310tcl2.dll -libpath:"C:/Program Files/TCL_TK/tcl_c_api2/
integpg" jnior300.lib -libpath:"C:/Program Files/Tcl/lib" Tcl84.lib -
libpath:"C:\Program Files\Microsoft Platform SDK for Windows Server
2003 R2\Lib" Kernel32.Lib User32.Lib Gdi32.Lib WinSpool.Lib
ComDlg32.Lib AdvAPI32.Lib Shell32.Lib Ole32.Lib OleAut32.Lib Uuid.Lib
error04a.txt

Error Message:
jnior310tcl2.c
c:\program files\tcl_tk\tcl_c_api2\integpg/jnior_300.h(19) : warning
C4031: second formal parameter list longer than the first list
c:\program files\tcl_tk\tcl_c_api2\integpg/jnior_300.h(19) : warning
C4028: formal parameter 1 different from declaration
c:\program files\tcl_tk\tcl_c_api2\integpg/jnior_300.h(19) : warning
C4142: benign redefinition of type
c:\program files\tcl_tk\tcl_c_api2\integpg/jnior_300.h(19) : warning
C4273: 'GetVersion' : inconsistent dll linkage
C:\Program Files\Microsoft Platform SDK for Windows Server
2003 R2\Include\winbase.h(1917) : see previous definition of
'GetVersion'
Creating library jnior310tcl2.lib and object jnior310tcl2.exp
jnior310tcl2.obj : error LNK2019: unresolved external symbol
_Connect@20 referenced in function _ConnectCmd
jnior310tcl2.obj : error LNK2019: unresolved external symbol
_Disconnect@4 referenced in function _DisconnectCmd
jnior310tcl2.dll : fatal error LNK1120: 2 unresolved externals




My source code, with your corrections, compile command:
cl jnior310tcl.c /EHs /I "C:/Program Files/Tcl/include" /I "C:/Program
Files/TCL_TK/tcl_c_api2/integpg" /LD "C:/Program Files/Tcl/lib/
Tcl84.lib" /LD "C:/Program Files/TCL_TK/tcl_c_api2/integpg/
jnior300.lib" /LD Kernel32.Lib /LD User32.Lib /LD Gdi32.Lib /LD
WinSpool.Lib /LD ComDlg32.Lib /LD AdvAPI32.Lib /LD Shell32.Lib /LD
Ole32.Lib /LD OleAut32.Lib /LD Uuid.Lib > error05.txt

Error Message:
jnior310tcl.c
Microsoft (R) Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

/out:jnior310tcl.dll
/dll
/implib:jnior310tcl.lib
jnior310tcl.obj
"C:/Program Files/Tcl/lib/Tcl84.lib"
"C:/Program Files/TCL_TK/tcl_c_api2/integpg/jnior300.lib"
Kernel32.Lib
User32.Lib
Gdi32.Lib
WinSpool.Lib
ComDlg32.Lib
AdvAPI32.Lib
Shell32.Lib
Ole32.Lib
OleAut32.Lib
Uuid.Lib
jnior310tcl.obj : error LNK2019: unresolved external symbol
_Connect@20 referenced in function _ConnectObjCmd
jnior310tcl.obj : error LNK2019: unresolved external symbol
_Disconnect@4 referenced in function _DisconnectObjCmd
jnior310tcl.dll : fatal error LNK1120: 2 unresolved externals


At this point, I feel that I'm using the "cl" command wrong, or I need
to fix my Environment.

The suckiest part of the project is getting IT to install or uninstall
SW.

-JC

P.S. To David and everyone, I want to thank you for helping me out on
your free time.
BTW: I know I won't be working on this C Environment much longer, but
I do feel like an idiot, that I forgot my C, how to debug C/C++ and
especially how to use the compiler. Was wondering what type of class/
books/projects you folks recommend to get me started. Since this is
something I plan to work on, during my free time.

Can't wait to I start coding in TCL.

.



Relevant Pages

  • compile firefox-3.0 source code
    ... I using ubuntu 8.04 and I want to compile Firefox source code. ... operation is deprecated.: command not found ...
    (Ubuntu)
  • compile firefox-3.0 source code
    ... I using ubuntu 8.04 and I want to compile Firefox source code. ... operation is deprecated.: command not found ...
    (Ubuntu)
  • Re: Copy Web site vs Publish Website vs Web Deployment Project
    ... The best way to prevent that possibility is to compile your classes ... No vb source uploaded = no one can pull up/read/download your vb source code in .vb files. ... navigate to the dir where your .vb files are, and run the compile command: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Video editing in Linux?
    ... I didn't say compile the kernel itself, it was my beleif that i had to ... compile the source code TO the kernel for it to become registered. ... Well if they're command line you don't need to install them you just ...
    (alt.linux)
  • Re: Debugging Newbie Question
    ... The CLR does not understand this source code and so before it ... ASP.NET, however, ASP.NET will compile your page's source code and cache ... the debugger will have IL and x86 created from ... in release mode assemblies. ...
    (microsoft.public.dotnet.faqs)