- Remove From My Forums
-
Question
-
Hi all,
I just installed Visual Studio 2010, and I began to compile my first program. I tried to use empty project and input below program:
#include <iostream>
using namespace std;void main() {
cout << «Hello world!» << endl;
}However, when I tried to compile it , I got below error:
1>—— Build started: Project: newProj, Configuration: Debug Win32 ——
1>Build started 8/29/2012 7:47:38 PM.
1>ClCompile:
1> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80×86
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> cl /c
1>
1>cl : Command line error D8003: missing source filename
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.88However, the compiler seems to work if I directly build the program, and the output from the build I got is:
‘newProj.exe’: Loaded ‘C:UsersSiyang’s workstationDocumentsVisual Studio 2010ProjectsnewProjDebugnewProj.exe’, Symbols loaded.
‘newProj.exe’: Loaded ‘C:WindowsSystem32ntdll.dll’, Cannot find or open the PDB file
‘newProj.exe’: Loaded ‘C:WindowsSystem32kernel32.dll’, Cannot find or open the PDB file
‘newProj.exe’: Loaded ‘C:WindowsSystem32KernelBase.dll’, Cannot find or open the PDB file
‘newProj.exe’: Loaded ‘C:WindowsSystem32msvcp100d.dll’, Symbols loaded.
‘newProj.exe’: Loaded ‘C:WindowsSystem32msvcr100d.dll’, Symbols loaded.
The program ‘[2736] newProj.exe: Native’ has exited with code 0 (0x0).Can anyone help me to find where the problem is? Thanks a million.
Answers
-
Hi Rocket303,
CL.exe invokes the preprocessor and compiler.
I am suggesting you to check the Preprocessor Definitions. Project properties ->
C/C++ -> PreprocessorDose it contains an unclosed double quote or other accidental characters?
Best regards,
Ego [MSFT]
MSDN Community Support | Feedback to us
-
Marked as answer by
Thursday, September 6, 2012 8:44 AM
-
Marked as answer by
I’m using Autotools to compile Matlab modules. Originally, we used Libtool to accomplish, but it really does a terrible job dealing with Microsoft’s compilers. As such, we are removing Libtool for Windows builds.
Here is some information that might be useful:
$ cl /V
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
$ uname -a
CYGWIN_NT-6.1 RatTop 1.7.18(0.263/5/3) 2013-04-19 10:39 i686 Cygwin
Unfortunately, I am having a linking error that I cannot explain:
CXXLD AverageFilter.mexw32
cl /DTRILIBRARY /DANSI_DECLARATORS /DNO_TIMER /D_HAVE_MATLAB_MODULES_ /D_GNU_SOURCE -O2 -DWIN32 -D_INTEL_WIN_ -EHsc /link /OUT:AverageFilter.mexw32 AverageFilter.obj /DLL /export:mexFunction /link /LIBPATH:"C:/root/extern/lib/win32/microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /INCREMENTAL:NO /manifest ./libISSMMatlab.a ../../c/libISSMModules.a ../../c/libISSMCore.a C:/root/home/Daeden/issm/trunk-jpl/externalpackages/petsc/install/lib/libpetsc.lib /link /LIBPATH:"C:/root/home/Daeden/issm/trunk-jpl/externalpackages/petsc/install/lib" libpetsc.lib /nologo
cl : Command line error D8003 : missing source filename
Makefile:860: recipe for target `AverageFilter.mexw32' failed
Can anyone explain how to get rid of this error? It would make sense if I was trying to compile, but I’m only trying to link.
I am trying to install cbpy on windows 10 with conda’s python and qt 5.9 and getting some errors. Could you help me figure out what’s wrong?
running install
running bdist_egg
running egg_info
writing cerebus.egg-infoPKG-INFO
writing dependency_links to cerebus.egg-infodependency_links.txt
writing requirements to cerebus.egg-inforequires.txt
writing top-level names to cerebus.egg-infotop_level.txt
reading manifest file 'cerebus.egg-infoSOURCES.txt'
writing manifest file 'cerebus.egg-infoSOURCES.txt'
installing library code to buildbdist.win-amd64egg
running install_lib
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6cerebus
copying cerebus__init__.py -> buildlib.win-amd64-3.6cerebus
running build_ext
skipping 'cerebuscbpy.cpp' Cython extension (up-to-date)
building 'cerebus.cbpy' extension
creating buildtemp.win-amd64-3.6
creating buildtemp.win-amd64-3.6Release
creating buildtemp.win-amd64-3.6Releasecerebus
C:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.14.26428binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:ProgramDataAnaconda3libsite-packagesnumpycoreinclude -IC:UsersUserDesktopCereLink-CereLink7.0distinclude -IC:UsersUserDesktopCereLink-CereLink7.0compat -IC:Qt5�.9msvc2017_64include -IC:ProgramDataAnaconda3include -IC:ProgramDataAnaconda3include "-IC:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.14.26428ATLMFCinclude" "-IC:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.14.26428include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.6.1includeum" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0um" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0cppwinrt" "-IC:Program Files (x86)Microsoft Visual Studio2017CommunityVCToolsMSVC14.14.26428binHostX86x64" /EHsc /Tpcerebuscbpy.cpp /Fobuildtemp.win-amd64-3.6Releasecerebuscbpy.obj
cl : Command line error D8003 : missing source filename
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\cl.exe' failed with exit status 2
I’m using Autotools to compile Matlab modules. Originally, we used Libtool to accomplish, but it really does a terrible job dealing with Microsoft’s compilers. As such, we are removing Libtool for Windows builds.
Here is some information that might be useful:
$ cl /V
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
$ uname -a
CYGWIN_NT-6.1 RatTop 1.7.18(0.263/5/3) 2013-04-19 10:39 i686 Cygwin
Unfortunately, I am having a linking error that I cannot explain:
CXXLD AverageFilter.mexw32
cl /DTRILIBRARY /DANSI_DECLARATORS /DNO_TIMER /D_HAVE_MATLAB_MODULES_ /D_GNU_SOURCE -O2 -DWIN32 -D_INTEL_WIN_ -EHsc /link /OUT:AverageFilter.mexw32 AverageFilter.obj /DLL /export:mexFunction /link /LIBPATH:"C:/root/extern/lib/win32/microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /INCREMENTAL:NO /manifest ./libISSMMatlab.a ../../c/libISSMModules.a ../../c/libISSMCore.a C:/root/home/Daeden/issm/trunk-jpl/externalpackages/petsc/install/lib/libpetsc.lib /link /LIBPATH:"C:/root/home/Daeden/issm/trunk-jpl/externalpackages/petsc/install/lib" libpetsc.lib /nologo
cl : Command line error D8003 : missing source filename
Makefile:860: recipe for target `AverageFilter.mexw32' failed
Can anyone explain how to get rid of this error? It would make sense if I was trying to compile, but I’m only trying to link.
Microsoft’s C/C++ compiler can pass options to the linker via the ‘/link’ command or by commands known as Compiler-Controlled LINK Options.
The ‘/Fe’ option is thus equivalent to ‘/link /OUT:’. This definitely solves the problem.
Alternatively, the order of the flags can fix the issue. By changing this:
/link /OUT:AverageFilter.mexw32 AverageFilter.obj
To this:
AverageFilter.obj /link /OUT:AverageFilter.mexw32
The linker is called correctly.
Я использую Autotools для компиляции модулей Matlab. Первоначально мы использовали Libtool для достижения цели, но она действительно делает ужасную работу с компиляторами Microsoft. Таким образом, мы удаляем сборки Libtool для Windows.
Вот некоторая информация, которая может быть полезна:
$ cl /V
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.$ uname -a
CYGWIN_NT-6.1 RatTop 1.7.18(0.263/5/3) 2013-04-19 10:39 i686 Cygwin
К сожалению, у меня ошибка связи, которую я не могу объяснить:
CXXLD AverageFilter.mexw32
cl /DTRILIBRARY /DANSI_DECLARATORS /DNO_TIMER /D_HAVE_MATLAB_MODULES_ /D_GNU_SOURCE -O2 -DWIN32 -D_INTEL_WIN_ -EHsc /link /OUT:AverageFilter.mexw32 AverageFilter.obj /DLL /export:mexFunction /link /LIBPATH:"C:/root/extern/lib/win32/microsoft" libmx.lib libmex.lib libmat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /INCREMENTAL:NO /manifest ./libISSMMatlab.a ../../c/libISSMModules.a ../../c/libISSMCore.a C:/root/home/Daeden/issm/trunk-jpl/externalpackages/petsc/install/lib/libpetsc.lib /link /LIBPATH:"C:/root/home/Daeden/issm/trunk-jpl/externalpackages/petsc/install/lib" libpetsc.lib /nologo
cl : Command line error D8003 : missing source filename
Makefile:860: recipe for target `AverageFilter.mexw32' failed
Может кто-нибудь объяснить, как избавиться от этой ошибки? Это имело бы смысл, если бы я пытался скомпилировать, но я только пытаюсь связать.
2
Решение
Компилятор Microsoft C / C ++ может передавать параметры компоновщику с помощью команды / link или с помощью команд, известных как Управляемые компилятором опции LINK.
Таким образом, опция ‘/ Fe’ эквивалентна ‘/ link / OUT:’. Это определенно решает проблему.
Кроме того, порядок флагов может решить проблему. Изменяя это:
/link /OUT:AverageFilter.mexw32 AverageFilter.obj
К этому:
AverageFilter.obj /link /OUT:AverageFilter.mexw32
Линкер вызывается правильно.
2
Другие решения
для моего конкретного случая, в
свойства проекта c ++ -> общие -> командная строка
у меня были варианты
/ I «$ (OutDir)» / I «..»
и я должен был изменить это в
/ Я «($ (OutDir))«/ Я» .. »
1
Topic: Microsoft Visual C++ 2010 isn’t working (Read 13344 times)
As my Username may suggest, I am a complete beginner when it comes to programming in C. I installed Code::Blocks and installed it, and I then went to Microsoft’s site and downloaded Microsoft Visual C++ 2010 and installed that too. When I first opened Code::Blocks, it asked me which compiler I wanted to use, so I opened the drop-down menu and selected Microsoft Visual C++ 2010. Then I wrote a simple ‘Hello World’ program to try it out, but I quickly found out that:
Build > Build does nothing
Build > Compile Current File does nothing
Build > Run > Yes does nothing
Build > Run > No returns a blank window, and
Build > Build and Run does nothing.
I went back to Settings > Compiler…, and it told me that the compiler’s installation directory was «C:Program FilesMicrosoft Visual Studio 10.0VC». When I checked the Program Files folder myself, I found that there was no such folder. Should the directory listed in the Code::Blocks settings be different, or is the problem being caused by something else?
Additional Info:
OS: Windows Vista Home Basic w/ Sevice Pack 2
OS Type: 32-bit
Logged
Logged
(most of the time I ignore long posts)
[strangers don’t send me private messages, I’ll ignore them; post a topic in the forum, but first read the rules!]
Yes, I have used autodetect, it just brings up a message saying «Could not detect auto-installation path of ‘Microsoft Visual C++’…»
I am using C::B v13.12.
As for that link, I’ll get on it, thank you!
Logged
Okay, I followed the instructions on that link you gave me, now whenever I click build it gives me an error saying «Can’t find compiler executable in you configured search path’s for Microsoft Visual C++ compiler.» So… that’s some progress at least…
Logged
What is the folder for your «Microsoft Visual C++ 2010» installation?
Tim S.
Logged
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
I can’t find it… I’ve searched all over the hard drive, it doesn’t seem to be anywhere…
Logged
Search for cl.exe. If you don’t have it then you don’t have c++ compiler installed.
Logged
(most of the time I ignore long posts)
[strangers don’t send me private messages, I’ll ignore them; post a topic in the forum, but first read the rules!]
Uninstalled/reinstalled it twice, it’s still not showing up.
Logged
Okay, I think I have it working, now when I click Build I get an error saying
cl: Command line error D8003 : Missing source filename
Logged
Logged
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
Here’s the entire log, this is all I can get out of it:
Compiling: C:UsersSamDesktophello.c
cl : Command line error D8003 : missing source filename
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Logged
Here’s the entire log, this is all I can get out of it:
Compiling: C:UsersSamDesktophello.c
cl : Command line error D8003 : missing source filename
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Post the «Build Log» NOT the «message log»!
Tim S.
Logged
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
That IS the Log, the Message tab just says:
||=== Build failed: 0 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
« Last Edit: March 29, 2014, 08:47:58 pm by n00b96 »
Logged
Then turn on full commandline logging, as described in the link given to you.
Logged
Hello Clifford,
Please find full source code for mailing.c, below.
Pellum.
include <stdlib.h>
include <stdio.h>
include <ctype.h>
include <string.h>
/Global structure of name and address./
struct mail_struct /Does not compile. Error D8003 missing source filename/
{
char name[25]; /The best working program./
char address[25];
char city[20];
char province[20];
char zipcode[7];
char code[10]; /For additional expansion./
};
/Global file pointer./
FILE *fp;
/Defined constants./
/MAX is the total number of names allowed in memory for reading mailing
lists./
define MAX 250
define FILENAME » MAIL.DAT»
/Prototype all of the program’s functions./
void disp_menu(void);
void enter_na(void);
void change_na(void);
void print_na(void);
void err_msg(char err_msg[]);
void add_to_file(struct mail_struct item);
void pause_sc(void);
void flush_newline(char line);
void pr_data(struct mail_struct item);
void get_new_item(struct mail_struct item);
int getzip(char zipcode[]);
/************/
int main(void)
{
int ch;
struct mail_struct *list[MAX];
list[MAX] = malloc(sizeof(list));
if(list == NULL)
{
perror(«Unable to allocate memory»);
exit(EXIT_FAILURE);
}
do
{
disp_menu();
if(scanf(» %d», &ch)!= 1)
{
perror(«Call to scanf failed»);
exit(EXIT_FAILURE);
}
while(getchar() != ‘n’);
switch(ch)
{
case (1) : {enter_na();
break;}
case (2) : {change_na();
break;}
case (3) : {print_na();
break;}
case (4) : {break;}
default :{ err_msg(« You need to enter»);
printf(» 1 through 4 «);
exit(1);}
}
}
while (ch != 4);
free(list);
}
/***********/
void disp_menu(void) /Display the main menu of the program./
{
system(«cls»); /Clear screen./
printf(«ttMailing List Manager n»);
printf(«tt ———————nnnn»);
printf(«Do you want to:nnn»);
printf(«t1. Add names and addresses to the listnnn»);
printf(«t2. Change names and addresses in the listnnn»);
printf(«t3. Print names and addresses in the listnnn»);
printf(«t4. Exit this programnnn»);
printf(«What is your choice?»);
return;
}
/***********/
void enter_na(void)
{
system(«cls»);
struct mail_struct item;
int ch;
do
{
printf(«nnnnnEnter Name: «);
if(fgets(item.name, sizeof(item.name), stdin) != NULL)
{
flush_newline(item.name);
}
while(getchar()!= ‘n’);
printf(«nEnter Address: «);
if(fgets(item.address, sizeof(item.address), stdin) != NULL)
{
flush_newline(item.address);
}
while(getchar()!= ‘n’);
printf(«nEnter City: «);
if(fgets(item.city, sizeof(item.city), stdin) != NULL)
{
flush_newline(item.city);
}
while(getchar()!= ‘n’);
printf(«nEnter Province:»);
if(fgets(item.province, sizeof(item.province), stdin) != NULL)
{
flush_newline(item.province);
}
while(getchar()!= ‘n’);
getzip(item.zipcode);
strcpy(item.code, " "); /*Null out the code member.*/ add_to_file(item); /*Write new information to disk file*/ printf("nnDo you want to enter another name"); printf(" and address? (Y/N) "); ch=getchar(); getchar(); /*Discard carriage return.*/
}
while (toupper(ch)==’Y’);
return;
}
/***********/
void change_na(void)
{
system(«cls»);
struct mail_struct item;
int ch, s; /Holds size of structure./
int change_yes = 0; /Will be true if user finds a name to change.*/
char test_name[25];
printf(«nWhat is the name of the person you want to change?»);
if(fgets(test_name, sizeof(test_name), stdin) != NULL)
{
flush_newline(test_name);
}
while(getchar()!= ‘n’);
s = sizeof(struct mail_struct); /To ensure that fread() reads properly./
if((fp=fopen(FILENAME, «r+»))==NULL)
{
err_msg(«Read error-ensure file exists«);
return;
}
do
{
if(fread(&item, sizeof(struct mail_struct), 1, fp)!=s)
{
if(feof(fp)!= 0) /If EOF, quit reading./
{
break;
}
}
if(strcmp(item.name, test_name)==0)
{
pr_data(item); /Print name and address./
printf(«nIs this the name and address to «);
printf(» change? (Y/N) «);
ch=getchar();
getchar(); /Discard carriage return./
if(toupper(ch)==’N’)
{
continue; /Get another name./
}
get_new_item(&item); /Let user type new information./
fseek(fp, (long)-s, SEEK_CUR); /*Back up one structure.*/ fwrite(&item,sizeof(struct mail_struct), 1, fp); /*Rewrite information.*/ change_yes = 1; /*Changeed flag.*/ break; /*Finished.*/ } } while((ch = fgetc(fp))!= EOF); fclose(fp); if (!change_yes) { err_msg("*** End of file-couldn't find name ***"); } return;
}
/************/
void print_na(void)
{
system(«cls»);
struct mail_struct item;
int s, linectr=0;
int ch;
s = sizeof(struct mail_struct);
if((fp=fopen(FILENAME, «r»))==NULL)
{
err_msg(« Read error-ensure file exists «);
return;
}
do
{
if(fread(&item, sizeof(struct mail_struct), 1, fp)!= s)
{
if(feof(fp)!= 0)
{
break;
}
}
if (linectr>20) /Screen is full./
{
pause_sc();
linectr=0;
}
pr_data(item); /Print the name and address./
linectr+=4;
}
while((ch = fgetc(fp))!= EOF);
fclose(fp);
printf(«n- End of list — «);
pause_sc();
return;
}
/************/
void err_msg(char msg[])
{
printf(«nn%s», msg);
return;
}
/***********/
void add_to_file(struct mail_struct item)
{
if((fp = fopen(FILENAME, «a»))==NULL) /Open file to append mode./
{
err_msg(« Disk error — please check disk drive«);
return;
}
fwrite(&item, sizeof(item), 1, fp); /Add structure to the file.*/
fclose(fp);
return;
}
/************/
void pause_sc()
{
int ch;
printf(«nPress the Enter key to continue…»);
ch = getchar();
getchar();
return;
}
/***********/
void flush_newline(char line)
{
char p;
if((p = strchr(line, ‘n’)) != NULL)
p = »;
return;
}
/***********/
void pr_data(struct mail_struct item)
{
system(«cls»);
/Prints the name and address sent to it./
printf(«nName:%-25s n», item.name);
printf(«Address:%-25s n», item.address);
printf(«City:%-20s tProvince:%-20s ZIPcode:%-7s n»,
item.city,item.province,item.zipcode);
return;
}
/***********/
void get_new_item(struct mail_struct item)
{
system(«cls»);
struct mail_struct temp_item; /Holds temporary changed input./
printf(«nEnter new name and address information»);
printf(» belown(Press the «);
printf(«Enter key without typing data to retain old»);
printf(» information)nn»);
printf(«What is the new name?:»);
if(fgets(temp_item.name, sizeof(temp_item.name), stdin) != NULL)
{
flush_newline(temp_item.name);
strcpy((item).name, temp_item.name);
}
printf(«What is the address?:»);
if(fgets(temp_item.address, sizeof(temp_item.address), stdin) != NULL)
{
flush_newline(temp_item.address);
strcpy((item). address, temp_item.address);
}
while(getchar()!= ‘n’);
printf(«What is the city?:»);
if(fgets(temp_item.city, sizeof(temp_item.city), stdin) != NULL)
{
flush_newline(temp_item.city);
strcpy((item). city, temp_item.city);
}
while(getchar()!= ‘n’);
printf(«What is the province?:»);
if(fgets(temp_item.province, sizeof(temp_item.province), stdin) != NULL)
{
flush_newline(temp_item.province);
strcpy((item). province, temp_item.province);
}
while(getchar()!= ‘n’);
printf(«What is the ZIPcode?:»);
if(fgets(temp_item.zipcode,sizeof(temp_item.zipcode),stdin)!= NULL)
{
flush_newline(temp_item.zipcode);
strcpy((item). zipcode, temp_item.zipcode);
}
while(getchar()!= ‘n’);
(item).code[0] = 0; /Null out the code member (unused here) /
}
/***********/
int getzip(char zipcode[]) /Prints ZIPcode, but not in uppercase./
{
int i, bad_zip;
char p, buffer[7];
do
{
bad_zip = 0;
printf("Enter ZIPcode:"); if(fgets(buffer, sizeof(buffer), stdin) != NULL) { if((p = strchr(buffer, 'n')) != NULL) { *p = ''; } while(getchar()!= 'n'); } for(i = 0; buffer[i]; i++) { buffer[i] = toupper(buffer[i]); bad_zip = 1; break; } } while(bad_zip); return 0;
}
/****************/