Programación General > Visual C++
Problema con un .h
romo1987:
Hola, soy nuevo en el foro ^_^
Escribo para ver si alguien puede echarme una manita. Como parte de un proyecto para la universidad, quiero reproducir mp3 desde mi programa hecho en C++ con Visual Studio 2008.
Estuve buscando un poquito, y la solucion más sencilla que encontre utiliza CMP3_MCI.h
Así que, me baje ese ejemplo de internet, lo compilo... y nada, error:
fatal error C1083: Cannot open include file: 'CMP3_MCI.h': No such file or directory
La cuestión es que no parece encontrarme mi CMP3_MCI.h, y no entiendo por qué. En el explorador de soluciones lo tengo dentro de la carpeta Header files, y además lo metí en el directorio donde esta el .cpp del programa.
Sin embargo no parece encontrarlo. ¿Tengo que linkarlo de alguna manera en particular y por eso no me funciona? Agradecería que alguien me ayudase con esto :)
m0skit0:
¿Lo has puesto entre comillas?
--- Código: C ---#include "cmp3_mci.h" Los <> son para las librerías estándar solamente.
Salud
Eternal Idol:
En realidad:
#include
Syntax:
#include <filename>
#include "filename"
This command slurps in a file and inserts it at the current location. The main difference between the syntax of the two items is that if filename is enclosed in angled brackets, then the compiler searches for it somehow. If it is enclosed in quotes, then the compiler doesn't search very hard for the file.
While the behavior of these two searches is up to the compiler, usually the angled brackets means to search through the standard library directories, while the quotes indicate a search in the current directory. The spiffy new C++ #include commands don't need to map directly to filenames, at least not for the standard libraries. That's why you can get away with
#include <iostream>
…and not have the compiler choke on you.
http://www.cppreference.com/wiki/preprocessor/include
Syntax Form Action
Quoted form ("") This form instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.
Angle-bracket (<>) form This form instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.
The #include Directive.
romo1987:
Gracias x la aclaracion, ya no se me olvidará más jejeje.
Ahora estoy obteniendo 4 errores LNK2019:
Error 1 error LNK2019: unresolved external symbol "public: int __thiscall WMp3::Play(void)" (?Play@WMp3@@QAEHXZ) referenced in function _main example.obj PruebaMP3
Y otros 3 más parecidos...
Busqué en google al respecto y hablan de propiedades de diversos tipos de proyectos de los que ni he oido hablar, ni se que significan. Si me echan otra manita ya quedan ud. como reyes jaja :D
(Si viene con explicacion para dummies como antes, mejor, que es mejor aprender pk chilla el compilador a que te loa rreglen sin mas jeje :beer: )
Eternal Idol:
En realidad ahora no es un problema de compilacion sino de enlazado, tenes la cabecera (cmp3_mci.h) con las declaraciones pero no tenes el codigo binario, este tiene que venir o en un archivo de codigo objeto (.obj), libreria estatica (.lib) o libreria dinamica (.dll al final pero con su .lib de importacion para el enlazado).
Navegación
[#] Página Siguiente
Ir a la versión completa