-
Anonymous
Ошибка «Множественное определение» в Code::Blocks [дубликат]
Сообщение
Anonymous »
Я выполняю задание на C++, используя Code Block. Мой код следующий:
main.cpp:
Код: Выделить всё
#ifndef _common_h_
#include "common.h"
#define _common_h_
#endif
#ifndef _assignment2_cpp_
#include "assignment2.cpp"
#define _assignment2_cpp_
#endif
void writeFile(char* filename, string str)
{
char* file_name = filename;
FILE* f = 0;
f = fopen(file_name, "w");
if (f == NULL)
return;
char s[2000];
strcpy(s, str.c_str());
fwrite(s, strlen(s), 1, f);
fclose(f);
}
int main()
{
string result;
for(int i = 0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/76903308/multiple-definition-of-error-in-codeblocks[/url]
1728619867
Anonymous
Я выполняю задание на C++, используя Code Block. Мой код следующий:
main.cpp:
[code]#ifndef _common_h_
#include "common.h"
#define _common_h_
#endif
#ifndef _assignment2_cpp_
#include "assignment2.cpp"
#define _assignment2_cpp_
#endif
void writeFile(char* filename, string str)
{
char* file_name = filename;
FILE* f = 0;
f = fopen(file_name, "w");
if (f == NULL)
return;
char s[2000];
strcpy(s, str.c_str());
fwrite(s, strlen(s), 1, f);
fclose(f);
}
int main()
{
string result;
for(int i = 0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/76903308/multiple-definition-of-error-in-codeblocks[/url]