I'm working on building a Windows MFC application in Visual Studio 2010 using FFmpeg and SDL. However, I can't get the project to build after creating an MFC project from scratch and including the FFmpeg development libraries (avcodec.lib, avdevice.lib, avformat.lib, etc.). I'm using the development build from Zeranoe FFmpeg. I have configured the following in the Project Properties:
Set VC++ Directories -> Include Directories (added the FFmpeg "include" directories)
Set VC++ Directories -> Library Directories (to the FFmpeg "lib" directory)
Set Linker -> Input -> Additional Dependencies (to include avcodec.lib, etc.)
For what it's worth, the build succeeds when I omit FFmpeg's "include\libavutil" include from the VC++ Directories -> Include Directories.
Below are some of the first build errors I'm receiving (I won't post all, since it's long). Any help would be appreciated.
ClCompile:
stdafx.cpp
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atltime.h(371): error C3861: '_mktime64': identifier not found
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atltime.h(386): error C3861: '_localtime64_s': identifier not found
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\atltime.h(409): error C3861: '_gmtime64_s': identifier not found
c:\program files\microsoft sdks\windows\v7.0a\include\intsafe.h(144): warning C4005: 'INT8_MIN' : macro redefinition
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxtaskspane.h(279): error C2146: syntax error : missing ';' before identifier 'm_nLastAnimTime'
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxribboncategory.h(282): error C2146: syntax error : missing ';' before identifier 'm_ActiveTime'
c:\program files\microsoft visual studio 10.0\vc\atlmfc\include\afxdockingmanager.h(353): error C2146: syntax error : missing ';' before identifier 'm_clkLastTime'
Build FAILED.
I've referenced both of these articles, which were of help:
Visual Studio and libavcodec
Visual Studio and SDL
I think what you did is this. When you did your first 2 steps
Set VC++ Directories -> Include Directories (added the FFmpeg
"include" directories)
Set VC++ Directories -> Library Directories
(to the FFmpeg "lib" directory)
You have included them at the top of the list before MFC and ATL paths. Please move them to the bottom of the list using the up/down buttons. This should solve the problem
Have a look at Use FFmpeg in Visual Studio - it has a link to small Visual Studio 2010 project that builds against Zeranoe binaries.
Note that you need a inttypes.h file to succeed in building.
Your log shows issues with stdafx.cpp and this means that you have either search paths set wrong, or something is wrong in stdafx.h. Putting FFmpeg directories on top of search list might work out, however it might equally well break building for MFC part. I would rather have them on the bottom of the list, however the code itself should have the correct order of explicit #includes.
Related
I am trying to re-compile a hello world using Clang_C2 compiler on Visual studio 15.5 (latest).
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\type_traits(899,2): error : expected class name
1> { // determine whether _Ty has a trivial destructor
In file included from ..\hello_boost_exception\hello_boost_exception.cpp:11:
1>In file included from I:\modular-boost\boost/config.hpp:48:
1>In file included from I:\modular-boost\boost/config/stdlib/dinkumware.hpp:98:
1>In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\typeinfo:22:
1>In file included from C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\exception:7:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.12.25827\include\type_traits(898,47):
This looks as though I have some missing or incorrect library but I can't see what.
I have try various compiler versions C++14 (-std=c++1y) and library -stdlib=libc++ (should it use dinkumware version of type_traits?) but the error persists.
Suggestions most welcome.
Paul
I have a Windows project that came with a Makefile.vc. I would like to import this into Visual Studio 10.0. My initial effort is to run nmake and invoke the cl.exe compiler.
After getting some paths straights my first run generates this message:
cl /nologo /W3 /O1 -I..\./ -I..\charset/ -I..\windows/ -I..\unix/ -I..\macosx/ /D_WINDOWS /D_WIN32_WINDOWS=0x500 /DWINVER=0x500 /DHAS_GSSAPI /DSECURITY
_WIN32 /c ..\be_all_s.c
be_all_s.c
..\be_all_s.c(6) : fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.EXE"' : return code '0x2'
Stop.
Now I know where the VC stdio.h header is, on my PC it's at C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include. So it would be a simple matter to add a -I to the makefile and include this directory.
But durn burn it I don't think I should have to! Other build systems don't make me do this and why doesn't the command line compiler know where its standard headers are installed? So I'm asking if there's a config file, an .ini file or something else that cl reads that tells it where to look for the standard C library. I've been browsing the internet and Visual Studio help with no success.
Just after I posted the question I found the answer.
Start > All Programs > Microsoft Visual 10.0 > Microsoft Visual Studio Tools > Visual Studio Command Prompt
This gives me a command prompt with all the paths, env. variables etc. set.
Why didn't I find that earlier?
I have just installed Visual C++ 2010 Express on my laptop (running with Windows8) and I have created a new project (Win32 console Application).
VS 10 generates all the files, and when I build the solution I have the following message
1>------ Rebuild All started: Project: toDelete, Configuration: Debug Win32 ------
1> stdafx.cpp
1>c:\users\arthur\documents\visual studio 2010\projects\todelete\todelete\stdafx.h(10): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
According to what I have read in other forums, I should have the file stdio.h (and others) in the directory
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
It appears that this directory contains only a file srv.h
If my understanding is correct, Visual C++ Redistributable installs such files in this directory. I have reinstalled it without any change!
Could you please confirm that my understanding is correct, ie that the directory
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
should contains files such as stdio.h and then do you have any idea how to get them???
Many thanks!
I am trying to compile this library: http://www.mega-nerd.com/SRC/win32.html . but I am having some trouble. Here's what happens:
C:\libsamplerate-0.1.8>make
1 file(s) copied.
1 file(s) copied.
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
link.exe /nologo /dll /incremental:no /libpath:""C:\Program Files (x86)\
Microsoft Visual Studio 10.0\Common7\IDE"\Lib" /pdb:"libsamplerate-0.pdb" /impli
b:".\libsamplerate-0.lib" /machine:I386 /out:"libsamplerate-0.dll" /def:".\Win32
\libsamplerate-0.def" ".\src\samplerate.obj" ".\src\src_linear.obj" ".\src\src
_zoh.obj" ".\src\src_sinc.obj"
LINK : fatal error LNK1181: cannot open input file 'Files.obj'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\link.exe"' : return code '0x49d'
Stop.
I run vcvars32.bat prior to attempting to compile, I think I have all the right folders in my path variable, but I'm new to this so I'm not entirely sure. What am I doing wrong?
You are having a quoting issue with the line:
/libpath:""C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"\Lib"
Should be:
/libpath:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Lib"
You get error: "LINK : fatal error LNK1181: cannot open input file 'Files.obj'"
Because the linker thinks you are adding file "Files" as one of input libraries.
This comes from "C:\Program Files (x86)" (see the "Files"?) ;-)
Check if kb 815645 doesn't help:
You receive a "fatal error LNK1181" error message when you build a Managed C++ application
fatal error LNK1181: cannot open input file 'C:\Program.obj'
Scenario 2:
The linker error LNK1181 may also occur if you add an unqualified file to the Additional Dependencies project property, and that file does not exist in any of the search directories that are defined in the LIB environment variable or the /LIBPATH project property.
You may add the directory that contains library file to the LIBPATH to resolve the problem:
In Solution Explorer, right-click the project, and then click Properties.
In the Property Pages dialog box, expand Linker, and then click General.
In the Additional Library Directories field, specify the required library path.
I have visual studio 2010 and I want to set up glew.h on it.
i do this step but still I have linker error:
1.download glew pack
2.copy .h files to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include
3.copy .lib files to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib
4.copy glew32.dll to C:\Windows\SysWOW64
5.and finally go to myproject properties then go to linker->input add glew32.lib,
glu32.lib, and opengl32.lib to Additional Dependencies
but I still have this error:
error LNK2001: unresolved external symbol __imp____glewBlendEquation
I've been confronted to the same issue today, so even if I'm one month late for the answer, just add GLEW_STATIC to your preprocessor's definitions.
That's a common problem. Just download the source, recompile it and it will work.