Using VS2010 with an older Win32 C/C++ Project,
I'm trying to track down missing symbols in a project recently built. In the past I've used lib.exe to examine contents of libraries, but that doesn't seem to work anymore. For example
lib /List:libname.lib
returns only:
Microsoft (R) Library Manager Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved..
So what are the best practices for tracking down missing symbols in VS2010?
Thanks.
I repro, the command line syntax you use is wrong. Omit the colon:
C:\projects\cpptemp3\Debug>lib /list cpptemp3.lib
Microsoft (R) Library Manager Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
Debug\stdafx.obj
Debug\test.obj
As far as looking for symbols goes, I use dumpbin /symbol [lib or obj file]
Related
I am following this guide in order to build Opencascade frmo source:
https://github.com/tpaviot/oce/blob/master/BUILD.MINGWw64.md
I have done everything up to the MSYS part.
The CMake configuration and generation was succesfull.
I now have a folder with all the things that CMake generated.
So i start MSYS2, and i cd into that directory.
Then i type make.
This is what i get:
User1#User1-PC MSYS ~/Desktop/OpenCascade project/oce/BUILD
$ make
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\User1\Desktop\OpenCascade project\oce\BUILD>
As you can see, nothing happens, no compilation. There is a prompt for me to type. But nothing gets executed.
EDIT:
*I redid the proccess in a new directory, so that no space characters exist in my directory. Problem still remains.
*When i run make --version, i get this:
$ make --version
GNU Make 4.3 Built for x86_64-pc-msys Copyright (C) 1988-2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
*When i exit the prompt (CONTROL + C) i get this:
C:\Users\User1\Desktop\OPENCAS\oce\BUILD>make: *** [Makefile:1734: cmake_check_build_system] Interrupt
*These are the contents of the makefile, line 1734:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles\Makefile.cmake 0
*When i run make VERBOSE=1, i get this:
User1#User1-PC MSYS ~/Desktop/OPENCAS/oce/BUILD
$ make VERBOSE=1
"C:\Program Files\CMake\bin\cmake.exe" -SC:\Users\User1\Desktop\OPENCAS\oce -BC:\Users\User1\Desktop\OPENCAS\oce\BUILD --check-build-system CMakeFiles\Makefile.cmake 0
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
I'm using Visual Studio C++ Preprocessor to preprocess some files which are not C or C++ files (I find it very convenient).
Recently I upgraded from Visual Studio 2010 to 2015 and found out that the preprocessor behavior slightly changed. Some text that works on VS2010 gives an error on VS2015 and vice versa.
To illustrate the difference, here are two one liner files, ok2010.c and ok2015.c, and the preprocessing command line running with VS2010 and VS2015:
ok2010.c:
#define X `0'`'
ok2015.c:
#define X `0'`'`'
Preprocessing on VS2010:
c:\>cl -E ok2010.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
ok2010.c
#line 1 "ok2010.c"
c:\>cl -E ok2015.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
ok2015.c
#line 1 "ok2015.c"
ok2015.c(1) : error C2001: newline in constant
Preprocessing on VS2015:
c:\>cl -E ok2010.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
ok2010.c
#line 1 "ok2010.c"
ok2010.c(1): error C2001: newline in constant
c:\>cl -E ok2015.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
ok2015.c
#line 1 "ok2015.c"
I guess that the preprocessor handles differently tick (') and backtick (`), and expects them to be balanced. When they are not balanced it reports a newline in a quoted constant expression.
VS2010 ignores backtick entirely and expects only the ticks to be balanced, so this behavior makes sense.
However, I can't make sense of VS2015 behavior since it works only when both ticks and backticks are not balanced...
Any idea?
I haven't a clue when it comes to building makefiles - I am trying to build luafilesystem in Windows 7 x86 for use with Lua for Windows. I have scoured the internet for tutorials but I just can't figure it out. I got as far as to run NMAKE in the Developer Command Prompt but I received the following error:
C:\Users\Me\Desktop\luafilesystem-master\luafilesystem-master>nmake -f Makefile.win
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
cl /c /Fosrc\lfs.obj /MD /O2 /I"c:\lua5.1\include" src\lfs.c
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.30723 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
lfs.c
src\lfs.c(63) : fatal error C1083: Cannot open include file: 'lua.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
I'm not sure what I'm doing wrong. There was no lua.h in the set of files I downloaded directly from the official LuaFileSystem repository.
All I want is to install lfs to use in lua. If you can't figure out what I'm doing wrong but happen to know an easier way, please share. I hope I've provided enough information. Thanks.
You need to have the Lua interpreter you are compiling against to be compiled and available on your computer to access its header files (lua.h and few others) and Lua library/dll files. After you compile the right version of Lua interpreter you need (whether Lua 5.1 or Lua 5.2), set the environmental variables (or update the paths in the make file) LUA_LIBDIR, LUA_INC and LUA_LIB to point to your lua-folder, lua-folder\src, and the lua lib correspondingly.
I have .lib, .h and .dll files of 3rd party windows library written in C++ (using Visual Studio compiller)
How is it possible to use such .dll from Go program? Is it possible at all if cgo is using MinGW C++?
Can you please point to any examples online? I've tried calling native Windows DLLs using syscall.NewLazyDLL() but it didn't work for 3rd party DLLs.
Thanks!
I get errors like:
C:\DOCUME~1\Alex\LOCALS~1\Temp\go-build023179027\zelid\gowingui.a(_all.o): malformed pe file: unexpected flags 0xe0500020 for PE section .text
C:\DOCUME~1\Alex\LOCALS~1\Temp\go-build404633023\zelid\gowingui.a(_all.o): malformed pe file: unexpected flags 0xe0500020 for PE section .text
main._Cfunc_HTMLayoutProcND: undefined: _cgo_c2d779df8b44_Cfunc_HTMLayoutProcND
$ gcc --version
gcc (tdm-2) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ go version
go version go1.3.3 windows/386
since one week I'm trying to compile a demo Version of the JVMTI demo set. In this case I tried to compile the HeapViewer Source Code (I just renamed the file HeapViewer.c to HeapViewerByMG). I tried different compiler and used mainly the following code that I found on stackOverflow,too:
// compile with Microsoft Windows C++ compiler
set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_26"
set JVMTI_DEMO=%JAVA_HOME%\demo\jvmti
set AGENT_SRC=%JVMTI_DEMO%\agent_util\src
set CRW_SRC=%JVMTI_DEMO%\java_crw_demo\src
set CFLAGS=/MD /Zi /Ox /Os /Gy /c
cl %CFLAGS% /I%AGENT_SRC% %AGENT_SRC%\agent_util.c /I%CRW_SRC% /I%JAVA_HOME%\include /I%JAVA_HOME%\include\win32
cl %CFLAGS% /I%CRW_SRC% /I%JAVA_HOME%\include /I%JAVA_HOME%\include\win32 %CRW_SRC%\java_crw_demo.c
cl %CFLAGS% /I%AGENT_UTIL% /I%CRW_SRC% /I%JAVA_HOME%\include /I%AGENT_SRC% /I%JAVA_HOME%\include\win32 heapViewerByMG.c
link -dll -out:heapViewerByMG.dll heapViewerByMG.obj java_crw_demo.obj agent_util.obj
// compile with g++ compiler von MINGW
set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_26"
set JVMTI_DEMO=%JAVA_HOME%\demo\jvmti
set AGENT_SRC=%JVMTI_DEMO%\agent_util\src
set CRW_SRC=%JVMTI_DEMO%\java_crw_demo\src
gcc -c -I%AGENT_SRC% %AGENT_SRC%\agent_util.c -I%CRW_SRC% -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32
gcc -c -I%CRW_SRC% -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 %CRW_SRC%\java_crw_demo.c
gcc -c -o heapViewerByMG.dll -I%AGENT_UTIL% -I%AGENT_SRC% -I%CRW_SRC% -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 heapViewerByMG.c
My code compiles successful in both cases, but when I try to use the dll files, I will get following error:
"The application or DLL
(...)\heapViewerByMG.dll is not a valid
Windows image. Please check this
against your installation diskette."
I also looked up what this message means. The research told me, that this is then a corrupt file, but I can rule this out since I compiled a given source code by the JVM. Anyhow I believe it is just another option command that I need to let run the file successful. Does anyone of you have an idea?
Here are some details of my system:
C:\>java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
C:\>gcc --version gcc (GCC) 4.5.2 Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\>cl -version
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50727.762 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
Or after I changed the Microsoft Compiler from 64bit to 32bit (because this was one of the older error messages, when I started the agent)
C:\>VCVARS32
C:\>"C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
Setting environment for using Microsoft Visual Studio 2005 x86 tools.
C:\>cl -version
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
And I'm running a Microsoft Windows XP Professional Version 2002 Service Pack 3 on a Intel(R) 4 CPU 2.80GHz with 2.00 GB of RAM
Sorry for that system. Usually I'm using a MacBook Pro 2010 (2.8GHz Intel Core i7), but I figured out that MacOS doesn't have included the support of the JVMTI demo-version :(
I hope somebody can help me.
Greetings
Markus G.
I don't know where the difference to upper version is, but this command-lines creates an agent that runs well (on upper mentioned system), if you copy the dll-file into the library (..JAVA_HOME\JRE\BIN):
VCVARS32
cd C:\Program Files\Java\jdk1.6.0_26\demo\jvmti\heapViewerByMG\src
set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_26"
set JVMTI_DEMO=%JAVA_HOME%\demo\jvmti
set AGENT_SRC=%JVMTI_DEMO%\agent_util\src
set CRW_SRC=%JVMTI_DEMO%\java_crw_demo\src
set CFLAGS= /Op /Ox /Zi /Gy -DWIN32 /WX
cl %CFLAGS% /I%AGENT_SRC% %AGENT_SRC%\agent_util.c /I%CRW_SRC% /I%JAVA_HOME%\include /I%JAVA_HOME%\include\win32
cl %CFLAGS% /I%CRW_SRC% /I%JAVA_HOME%\include /I%JAVA_HOME%\include\win32 %CRW_SRC%\java_crw_demo.c
cl %CFLAGS% /I%AGENT_UTIL% /I%CRW_SRC% /I%JAVA_HOME%\include /I%AGENT_SRC% /I%JAVA_HOME%\include\win32 heapViewerByMG.c
link -dll -out:heapViewerByMG.dll heapViewerByMG.obj java_crw_demo.obj agent_util.obj
Now,copy the DLL File into upper mentioned directory and use following command line to run the test:
C:\Program Files\Java\jdk1.6.0_26\demo\jvmti\heapViewerByMG\src>java -agentlib:h
eapViewerByMG -version
Compile Time JVMTI Version: 1.1.102 (0x30010166)
Run Time JVMTI Version: 1.2.1 (0x30010201)
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
Anyhow, I still don't know, why this didn't work earlier ...
Markus G.