I translated -1073741819
to hexadecimal number (using Windows calculator):
-1073741819
= 0xC0000005
There is a table of all NTSTATUS Values on MSDN. The relevant row:
0xC0000005 STATUS_ACCESS_VIOLATION
The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.
This sounds like OP’s g++
is somehow broken as it looks for me that make.exe
reports the exit code -1073741819 of g++
.
In my 20 years professional experience, I had some rare cases where certain specific wrong C++ code made my compiler crashing (instead of just reporting an error). It did not happen for years anymore.
The OP’s sample code
#include <cstdlib>
#include <iostream>
using namespace std;
int name(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
looks IMHO much too innocent to cause such a compiler bug like mentioned above.
So, I agree with the advice of Yunnosch:
Try g++ --version
on console (e.g. cmd.exe
). a) Check of g++
is runnable at all. b) Have a look whether the version is not too outdated.
You may check also whether concurrent installations of tools with equal name are accidentally mixed somehow. This may happen e.g. by having conflicting locations in the PATH
environment variable.
Загрузка новой версии исправила мою проблему, спасибо за помощь.
Я не могу скомпилировать свою программу и понятия не имею почему? Я искал довольно трудно найти причину, почему это происходит безрезультатно. Я просто пытаюсь запустить пример по умолчанию, который дает вам dev-c ++ это то, что он выплевывает
Это журнал компиляции
Compiler: Default compiler
Building Makefile: "C:\Users\alex\Desktop\C++\test2\Makefile.win"Executing make...
make.exe -f "C:\Users\alex\Desktop\C++\test2\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
make.exe: *** [main.o] Error -1073741819
Execution terminated
-3
Решение
я перевел -1073741819
в шестнадцатеричное число (с помощью калькулятора Windows):
-1073741819
знак равно 0xC0000005
Есть таблица всех NTSTATUS ценности на MSDN. Соответствующая строка:
0xC0000005 STATUS_ACCESS_VIOLATION
Инструкция в 0x% 08lx ссылается на память в 0x% 08lx. Память не может быть% s.
Это звучит как ОП g++
как-то сломан, так как для меня это выглядит make.exe
сообщает код выхода -1073741819 из g++
,
За 20 лет профессионального опыта у меня были редкие случаи, когда определенный неправильный код C ++ приводил к сбою моего компилятора (вместо того, чтобы просто сообщать об ошибке). Это не происходило в течение многих лет.
Пример кода ОП
#include <cstdlib>
#include <iostream>
using namespace std;
int name(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
выглядит ИМХО слишком невинно, чтобы вызвать такую ошибку компилятора, как упомянуто выше.
Итак, я согласен с советом Юнноша:
Пытаться g++ --version
на консоли (например, cmd.exe
). а) проверка g++
работает на всех. б) Посмотрите, не слишком ли устарела версия.
Вы также можете проверить, не смешаны ли случайно параллельные установки инструментов с одинаковыми именами. Это может случиться, например, имея конфликтующие места в PATH
переменная окружения.
1
Другие решения
Других решений пока нет …
-
Summary
-
Files
-
Reviews
-
Support
-
Wiki
-
Mailing Lists
-
Code
-
Tickets ▾
- Feature Requests
- Bugs
- Patches
-
News
-
Discussion
Menu
▾
▴
dev C++ compilation wont work
Created:
2006-03-16
Updated:
2012-09-26
-
i dont know why but dev c++ compilations all give me build errors. i am using version 4.9.9.2 on windows xp home w/ SP 2.
Not even a the default programs can be compiled.#include <cstdlib>
#include <iostream>using namespace std;
int main(int argc, char *argv[])
{
system(«PAUSE»);
return EXIT_SUCCESS;
}Here is the compilation log:
Compiler: Default compiler
Building Makefile: «C:\CPPprojects\Makefile.win»
Executing make…
make.exe -f «C:\CPPprojects\Makefile.win» all
g++.exe -c main.cpp -o main.o -I»C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include»make.exe: *** [main.o] Error -1073741819
Execution terminated
Someone please if you can tell me why i get these errors and how can i fix them?
-
come to think of it i had microsfot visual for c++ beta 2005 installed a while ago but i uninstalled it
However dev was working with it installed but i dont know about after i uninstalled it -
I recommend trying first a clean uninstall — see the «Please Read Before Posting a Question» thread for directions — its not hard, but you have to the thorough.
Redownload 4.9.9.2 and install in the default directory.
Note the request in the uninstall directions on keeping careful note of what you do.
Wayne
p.s. The forum is breaking links again, but if you copy and paste the link in the Please Read thread, it works fine
-
I have compilation problems to, i’m triying to compile a c programm generated by pcyacc and i get the error macro «yywrap» passed 1 arguments, but takes just 0, how to solve this problem?
-
Start your own thread. The OP may not have had his problem solved yet, and you have butted in.
Clifford
-
Alright i uninstalled dev, and it prompted me to «remove configuration files» i clicked yes.
I assume these are the devcpp.cfg and devcpp.ini. Are they? because i did a search for devcpp on my hard drve and i get only 1 result. That is devcpp.FTS. Should I delete that too? -
Delete everything dev related, including the Dev folder etc….
Wayne
-
alrite i deleted that dev file and restarted my computer
I downloaded the installer for 4.9.9.2 with the compiler and other stuff.
i installed it to the default directory (c:\dev-c++) and checked all the boxes for the installation. (including remove previous config files)
When it asked for code completion i said no
i tried the same program by making a new project but i still got the same error. -
I guess you chose to ignore the uninstall directions about reporting exactly what you did to do the uninstall.
Are you running an anti-virus?
Wayne
-
Please try compiling your code without a project.
i.e. Open a New:Source File — enter a simple «Hello World» program, and compile it.Post your log please.
Wayne
-
wow thank you without a project it works
im really new at programmingheres the log:
Compiler: Default compiler
Executing g++.exe…
g++.exe «C:\TESTAGAIN\Untitled1.cpp» -o «C:\TESTAGAIN\Untitled1.exe» -I»C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include» -L»C:\Dev-Cpp\lib»
Execution terminated
Compilation successful-
Under Tools|Compiler options|Programs, try changing make.exe to c:\dev-cpp\bin\make.exe to ensure the correct make utility is being used. Not all builds of GNU make behave in the same way, and there are non-GNU implementations that will not work at all with Dev-C++.
Clifford
-
That is where I was heading next sir, thanks!
Wayne
-
I don’t think I actually fixed anything — this was just a test of your setup. Yes, you can compile without a project, as long as you are only compiling single files, but hopefully, your skills will outgrow that (I HOPE they outgrow mine for that matter)
Clearly, something is messing with make.
Do you have something else like Cygwin, or a Borland compiler, on your machine.
Wayne
-
hmm… i changed tools > compiler options > programs > make: to «c:\dev-cpp\bin\make.exe» i tried running the project again but still wont work. Here is the compile log it
Compiler: Default compiler
Building Makefile: «C:\testtest\Makefile.win»
Executing make…
c:\dev-cpp\bin\make.exe -f «C:\testtest\Makefile.win» all
g++.exe -c main.cpp -o main.o -I»C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include»c:\dev-cpp\bin\make.exe: *** [main.o] Error -1073741819
Execution terminated
Same problems still i guess.
BTW yes i have McAffee Antivirus (disabling doesnt help)
and no i dont have Borland or Cygwin or any compiling programs that i can think of.
Log in to post a comment.
Вопрос:
мое задание – взять в файл данных все возможные буквы для каждой кубики из игры Boggle. Вот копия файла данных:
D R L X E I
C P O H S A
N H N L Z R
W T O O T A
I O S S E T
N W E G H E
B O O J A B
U I E N E S
P S A F K F
I U N H M Qu
Y R D V E L
V E H W H R
I O T M U C
T Y E L T R
S T I T Y D
A G A E E N
Каждый штамп принимает 6 букв, и они хранятся в связанном списке. Когда я попытался запустить следующий код, я продолжаю получать код ошибки: C:\Dev-Cpp\Makefile.win [Build Error] [Untitled1.o] Error -1073741819
Я пробовал использовать 3 разных IDE, но всегда кажется, что некоторые компилируются. Я не могу понять, где я ошибаюсь! Это еще не завершено ни какими средствами, но лучше это выяснит, прежде чем я буду углубляться и углубляться. Заранее спасибо!
код:
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define LENGTH 80
struct boggleDataNode{
char data[3];
struct boggleDataNode *nextData;
}*head;
struct boggleDieSideNode{
char dieSideData[3];
struct boggleDieSideNode *nextSide;
}*head1;
void readData(struct boggleDataNode temp);
int main(){
int counter = 0;
struct boggleDataNode *head;
struct boggleDieSideNode *head1;
struct boggleDataNode *temp;
*head = NULL;
*head1 = NULL;
*temp = *head;
readData(*temp);
system("pause");
return 0;
}
void readData(struct boggleDataNode temp){
//initializing variables including
//opening the input file
FILE *input = fopen("BoggleData.txt","r");
int name =0;
int id=0;
char data[96] ={};
//error checking that the file opened
if (input == NULL){
fprintf(stderr, "Can't open input file!\n");
exit(1);
}
while( fscanf(input, "%s", &data) != EOF)
printf("%s", data);
}
Лучший ответ:
В вашем коде измените
struct boggleDataNode{
char data[3];
struct boggleDataNode *nextData;
}*head;
в
struct boggleDataNode{
char data[3];
struct boggleDataNode *nextData;
};
так как вам все равно не нужен глобальный указатель на эту структуру. Согласно вашему использованию, он будет затенен местным head
.
То же самое касается и head1
.
Затем вы назначаете NULL
самому указателю, а не переменной, на которую указывает. (FWIW, NULL
сам по себе является указателем, но недействительным).
+ Изменить
*head = NULL;
в
head = NULL;
Ответ №1
Независимо от того, что еще в вашей программной логике не так, есть также синтаксическая ошибка в
char data[96] ={};
поскольку ISO C запрещает пустые инициализаторы массива. Если из-за этого выйдете из строя, это может объяснить “Ошибка сборки”. Если вы хотите, чтобы данные были инициализированы нолем, будет выполняться одно = { 0 }
.
Также неплохо проверить уровень предупреждения вашего компилятора, добавив соответствующие параметры. Какая система (ОС)? Какой компилятор?
Ответ №2
попробуйте удалить амперсанд из “& data”, потому что я считаю, что вы пытаетесь прочитать строку, поэтому передайте строку, а не директиву.
while( fscanf(input, "%s", &data) != EOF)
printf("%s", data);
поэтому у вас будет следующее:
while( fscanf(input, "%s", data) != EOF)
printf("%s", data);
Ответ №3
настоятельно рекомендуем при компиляции включить все предупреждения, затем исправить эти предупреждения. В конце концов, компилятор знает язык намного лучше, чем мы, люди.
Следующий код
1) компилируется чисто,
2) имеет ненужные элементы, которые были прокомментированы или #if 0… # endif out
3) проверка ошибок ввода
4) использует “perror()” для правильной выдачи информации об ошибках системной функции, включая сообщение, относящееся к текущему значению “errno”
5) закрывает входной файл после завершения чтения
6) fscanf() остановится после чтения одного числового символа из входного файла, потому что% s остановится, когда встретится какое-либо “белое пространство”.
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
//#define LENGTH 80
// Note: surround numeric #defines with parens to avoid text substituion errors
#define MAX_DATA_LEN (96)
#if 0
struct boggleDataNode
{
char data[3];
struct boggleDataNode *nextData;
};
#endif
#if 0
struct boggleDieSideNode
{
char dieSideData[3];
struct boggleDieSideNode *nextSide;
};
#endif
void readData( void );
int main( void )
{
//int counter = 0;
//struct boggleDataNode *head = NULL;
//struct boggleDieSideNode *head1 = NULL;
//struct boggleDataNode *temp = NULL;
readData();
system("pause");
return 0;
} // end function: main
void readData()
{
//initializing variables including
//opening the input file
//int name =0;
//int id=0;
char data[ MAX_DATA_LEN ];
FILE *input = fopen("BoggleData.txt","r");
//error checking that the file opened
if (input == NULL)
{
perror("Can't open input file!\n");
exit(1);
}
// implied else, fopen successful
while( 1 == fscanf(input, " %s", data)) // note: format string leading space to skip 'white space'
printf("%s", data);
fclose( input );
} // end function: readData
Я перевел -1073741819
в шестнадцатеричное число (с помощью калькулятора Windows):
-1073741819
знак равно 0xC0000005
На MSDN есть таблица всех значений NTSTATUS. Соответствующая строка:
0xC0000005 STATUS_ACCESS_VIOLATION
Инструкция в 0x%08lx ссылается на память в 0x%08lx. Память не может быть%s.
Это звучит как ОП g++
как-то сломан, так как для меня это выглядит make.exe
сообщает код выхода -1073741819 из g++
,
За 20 лет профессионального опыта у меня были редкие случаи, когда определенный неправильный код C++ приводил к сбою моего компилятора (вместо того, чтобы просто сообщать об ошибке). Это не происходило в течение многих лет.
Пример кода ОП
#include <cstdlib>
#include <iostream>
using namespace std;
int name(int argc, char *argv[])
{
system("PAUSE");
return EXIT_SUCCESS;
}
выглядит ИМХО слишком невинно, чтобы вызвать такую ошибку компилятора, как упомянуто выше.
Итак, я согласен с советом Юнноша:
Пытаться g++ --version
на консоли (например, cmd.exe
). а) проверка g++
работает на всех. б) Посмотрите, не слишком ли устарела версия.
Вы также можете проверить, не смешаны ли случайно параллельные установки инструментов с одинаковыми именами. Это может произойти, например, из-за наличия конфликтующих мест в PATH
переменная окружения.