 |
Ver Mensagens sem resposta | Ver Tópicos Activos
| [ +/- ]
[ Data/Hora: 19 Mai 2013, 18:36 ]
|
|
| Autor |
Mensagem |
|
michel almeida
|
Assunto da Mensagem: nao consigo compilar com codebloks esse codigo fonte Enviado: 29 Fev 2012, 14:37 |
|
Registado: 21 Fev 2012, 19:23 Mensagens: 19
|
|
| Topo |
|
 |
|
bcsanches2
|
Assunto da Mensagem: Re: nao consigo compilar com codebloks esse codigo fonte Enviado: 29 Fev 2012, 15:51 |
|
Registado: 23 Nov 2003, 18:58 Mensagens: 2808 Localização: Brasil
|
|
Qual o erro de compilação? Mais fácil você dizer o erro e o trecho de código que da problema do que alguém baixar o code blocks e o tal projeto.
T+
_________________ Quer aprender a fazer jogos? http://www.pontov.com.br/ Meus jogos
|
|
| Topo |
|
 |
|
michel almeida
|
Assunto da Mensagem: Re: nao consigo compilar com codebloks esse codigo fonte Enviado: 29 Fev 2012, 16:48 |
|
Registado: 21 Fev 2012, 19:23 Mensagens: 19
|
entao vamos la foram esses erros que deram quando compilei Code: _________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\category.cc |21| error: portable.h: No such file or directory|
#include "portable.h" foi o primeiro erro __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\resource.h |24| error: fz.h: No such file or directory|
#include "fz.h" foi o segundo __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h | | In function 'std::string path_import(const std::string&)':| __________________________________________________________ inline std::string path_import(const std::string& s) { X return file_import(s.c_str()); } na parte onde ta o x onde deu erro __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h |33| error: 'file_import' was not declared in this scope| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h | | In function 'std::string path_export(const std::string&)':| ___________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h |38| error: 'file_export' was not declared in this scope| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h | | In function 'std::string list_import(const std::string&)':| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h |43| error: 'file_import' was not declared in this scope| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h | | In function 'std::string list_export(const std::string&)':| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h |48| error: 'file_export' was not declared in this scope| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h | | In function 'const char* cpath_import(const std::string&)':| _________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h |53| error: 'file_import' was not declared in this scope| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h | | In function 'const char* cpath_export(const std::string&)':| ________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h |58| error: 'file_export' was not declared in this scope| ___________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h | | In function 'const char* clist_import(const std::string&)':| ___________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h |63| error: 'file_import' was not declared in this scope| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h | | In function 'const char* clist_export(const std::string&)':| __________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\common.h |68| error: 'file_export' was not declared in this scope| ________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\resource.h |67| error: ISO C++ forbids declaration of 'adv_fz' with no type| ________________________________________________________ C:\CodeBlocks\advancemenu-2.5.0\advance\menu\resource.h |67| error: expected ';' before '*' token|
adv_fz* open() const; referencia de erro ________________________________________________________
||=== Build finished: 12 errors, 0 warnings ===| agora fica mas facio e para cada erro que deu uma parte da linha para referencia
|
|
| Topo |
|
 |
|
bcsanches2
|
Assunto da Mensagem: Re: nao consigo compilar com codebloks esse codigo fonte Enviado: 29 Fev 2012, 21:54 |
|
Registado: 23 Nov 2003, 18:58 Mensagens: 2808 Localização: Brasil
|
Os dois primeiros indicam que os arquivos não foram encontrados pelo compilador, se eles estão no projeto, então você tem que configurar o code blocks para que o compilador saiba onde procurar eles. Neste artigo, no item "Configurando o cOmpilador" mostra como fazer isso para SDL: http://www.pontov.com.br/site/opengl/13 ... -sdlopenglNo seu caso da na mesma, só usar o diretório onde estão esses arquivos. T+
_________________ Quer aprender a fazer jogos? http://www.pontov.com.br/ Meus jogos
|
|
| Topo |
|
 |
|
michel almeida
|
Assunto da Mensagem: Re: nao consigo compilar com codebloks esse codigo fonte Enviado: 01 Mar 2012, 21:31 |
|
Registado: 21 Fev 2012, 19:23 Mensagens: 19
|
eu to compilando no code::blocks 10,05 consegui configurar para compilar e estou com 9 erros e nao sei como resouver os textos sao esses cammon.cc Código:
/* * This file is part of the Advance project. * * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 Andrea Mazzoleni * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "portable.h"
#include "common.h" #include "crc.h"
#include "advance.h"
#include <iostream>
using namespace std;
string file_basename(const string& s) { int i = s.rfind('.'); if (i == string::npos) return s; else return string(s, 0, i); }
string file_ext(const string& s) { int i = s.rfind('.'); if (i == string::npos) return ""; else return string(s, i, s.length()-i); }
string file_dir(const string& s) { int i = s.find_last_of("/"); if (i == string::npos) return ""; else return string(s, 0, i+1); }
string file_file(const string& s) { int i = s.find_last_of("/"); if (i == string::npos) return s; else return string(s, i+1, s.length()-(i+1)); }
string slash_add(const string& s) { string r = s; if (r.length() && r[r.length()-1]!='/') r += '/'; return r; }
bool file_exists(const string& path) { return access(cpath_export(path), F_OK)==0; }
string slash_remove(const string& s) { if (s.length() && s[s.length()-1]=='/') return s.substr(0, s.length()-1); else return s; }
bool file_crc(const string& file, unsigned& crc) { struct stat st;
if (stat(cpath_export(file), &st)!=0) return false;
FILE* f = fopen(cpath_export(file), "rb"); if (!f) return false;
unsigned char* data = (unsigned char*)operator new(st.st_size);
if (fread(data, st.st_size, 1, f)!=1) { fclose(f); return false; }
fclose(f);
crc = crc_compute(0, data, st.st_size);
operator delete(data); return true; }
string token_get(const string& s, int& ptr, const char* sep) { int start = ptr; while (ptr < s.length() && strchr(sep, s[ptr])==0) ++ptr; return string(s, start, ptr-start); }
void token_skip(const string& s, int& ptr, const char* sep) { while (ptr < s.length() && strchr(sep, s[ptr])!=0) ++ptr; }
std::string token_get(const std::string& s, int& ptr, char sep) { char sep_string[2]; sep_string[0] = sep; sep_string[1] = 0; return token_get(s, ptr, sep_string); }
void token_skip(const std::string& s, int& ptr, char sep) { char sep_string[2]; sep_string[0] = sep; sep_string[1] = 0; token_skip(s, ptr, sep_string); }
string strip_space(const string& s) { string r = s; while (r.length() && isspace(r[0])) r.erase(0, 1); while (r.length() && isspace(r[r.length()-1])) r.erase(r.length()-1, 1); return r; }
string strip_comment(const string& s) { bool in = false; bool pred_space = true; string r; for(int i = 0;i<s.length();++i) { if (s[i]=='(' || s[i]=='[') { in = true; } else if (s[i]==')' || s[i]==']') { in = false; } else { if (!in) { if (!isspace(s[i]) || !pred_space) { r += s[i]; pred_space = isspace(s[i]); } } } } return r; }
bool file_findinzip_byname(const string& zip_file, const string& name, string& file, unsigned& crc) { adv_zip* zip; adv_zipent* ent;
if (access(cpath_export(zip_file), F_OK)!=0) return false;
zip = zip_open(cpath_export(zip_file)); if (!zip) return false;
while ((ent = zip_read(zip))!=0) { string zfile = ent->name; string zname = file_basename(zfile); if (zname == name) { crc = ent->crc32; file = zfile; zip_close(zip); return true; } }
zip_close(zip); return false; }
bool file_findinzip_byfile(const string& zip_file, const string& name, string& file, unsigned& crc) { adv_zip* zip; adv_zipent* ent;
if (access(cpath_export(zip_file), F_OK)!=0) return false;
zip = zip_open(cpath_export(zip_file)); if (!zip) return false;
while ((ent = zip_read(zip))!=0) { string zfile = ent->name; if (zfile == name) { crc = ent->crc32; file = zfile; zip_close(zip); return true; } }
zip_close(zip); return false; }
string file_select_random(const path_container& c) { int n = rand() % c.size(); path_container::const_iterator i = c.begin(); while (n) { ++i; --n; } return *i; }
string arg_get(const string& s, int& ptr) { // skip spaces while (ptr < s.length() && isspace(s[ptr])) ++ptr;
string r; if (ptr < s.length() && s[ptr]=='"') { ++ptr; while (ptr < s.length() && s[ptr]!='"') { r += s[ptr]; ++ptr; } if (ptr < s.length() && s[ptr]=='"') ++ptr; } else { while (ptr < s.length() && !isspace(s[ptr])) { r += s[ptr]; ++ptr; } }
// skip spaces while (ptr < s.length() && isspace(s[ptr])) ++ptr;
return r; }
bool arg_split(const string& s, string& a0) { int i = 0; a0 = arg_get(s, i); return i == s.length(); }
bool arg_split(const string& s, string& a0, string& a1) { int i = 0; a0 = arg_get(s, i); a1 = arg_get(s, i); return i == s.length(); }
bool arg_split(const string& s, string& a0, string& a1, string& a2) { int i = 0; a0 = arg_get(s, i); a1 = arg_get(s, i); a2 = arg_get(s, i); return i == s.length(); }
bool arg_split(const string& s, string& a0, string& a1, string& a2, string& a3) { int i = 0; a0 = arg_get(s, i); a1 = arg_get(s, i); a2 = arg_get(s, i); a3 = arg_get(s, i); return i == s.length(); }
string dir_cat(const string& A, const string& B) { if (A.length()) { if (B.length()) return A + ':' + B; else return A; } else { if (B.length()) return B; else return ""; } }
string path_abs(const string& rel, const string& cwd) { string r = slash_remove(cwd); int pos = 0; while (pos < rel.length()) { if (rel.length() >= 3 && rel.substr(pos, 3)=="../") { int slash = r.rfind('/'); if (slash != string::npos) { r.erase(slash, r.length() - slash); } pos += 3; } else if (rel.length() >= 2 && rel.substr(pos, 2)=="./") { pos += 2; } else if (rel.length() >= 1 && rel.substr(pos, 1)=="/") { r = "/"; pos += 1; } else { int slash = rel.find('/', pos); r = slash_add(r); if (slash == string::npos) { r += rel.substr(pos, rel.length() - pos); pos = rel.length(); } else { r += rel.substr(pos, slash - pos); pos = slash + 1; } } } if (r.length() == 0) r = '/'; return r; }
string path_rel(const string& abs, const string& cwd) { string c = slash_add(cwd);
unsigned pos = 0; int slash = c.find('/', pos); while (slash != string::npos && abs.substr(pos, slash-pos) == cwd.substr(pos, slash-pos)) { pos = slash + 1; slash = c.find('/', pos); }
unsigned last_pos = pos; string r; while (slash != string::npos) { r += "../"; pos = slash + 1; slash = c.find('/', pos); }
r += abs.substr(last_pos, abs.length() - last_pos);
return r; }
string path_short(const string& abs, const string& cwd) { string rel = path_rel(abs, cwd); if (rel.length() < abs.length()) return rel; else return abs; }
string list_abs(const string& list, const string& cwd) { string r; int i = 0; while (i<list.length()) { if (r.length()) r += ':'; r += path_abs(token_get(list, i, ":"), cwd); token_skip(list, i, ":"); } return r; }
string dir_cwd() { char cwd[FILE_MAXPATH]; if (getcwd(cwd, FILE_MAXPATH)==0) { return "/"; } else { return file_import(cwd); } }
bool case_less(const string& A, const string& B) { int i = 0; int l = min(A.length(), B.length()); while (i < l) { char ca = toupper(A[i]); char cb = toupper(B[i]); if (ca < cb) return true; if (ca > cb) return false; ++i; } return A.length() < B.length(); }
bool case_equal(const string& A, const string& B) { if (A.length() != B.length()) return false;
for(int i=0;i<A.length();++i) if (toupper(A[i]) != toupper(B[i])) return false;
return true; }
string case_auto(const string& A) { for(unsigned i=0;i<A.length();++i) if (isupper(A[i])) return A;
string r = A; for(unsigned i=0;i<r.length();++i) { if (i==0 || isspace(r[i-1])) r[i] = toupper(r[i]); }
return r; }
string subs(const string& s, const string& from, const string& to) { string r = s; int sub = r.find(from); while (sub != string::npos) { r.erase(sub, from.length()); r.insert(sub, to); sub = r.find(from); } return r; }
bool is_glob(const char* str_begin, const char* str_end, const char* glob_begin, const char* glob_end) { if (str_begin == str_end && glob_begin == glob_end) return true; if (str_begin != str_end && glob_begin != glob_end) { if (*glob_begin == '*') return is_glob(str_begin + 1, str_end, glob_begin, glob_end) || is_glob(str_begin, str_end, glob_begin + 1, glob_end); if (*glob_begin == *str_begin) return is_glob(str_begin + 1, str_end, glob_begin + 1, glob_end); } return false; }
bool is_glob(const string& str, const string& glob) { return is_glob(str.c_str(), str.c_str() + str.length(), glob.c_str(), glob.c_str() + glob.length()); }
bool is_globlist(const string& file, const string& globlist) { unsigned i = 0; if (globlist.length() == 0) return true; while (i<globlist.length()) { int end = globlist.find(':', i); if (end == string::npos) { string filter(globlist, i); i = globlist.size(); if (is_glob(file, filter)) return true; } else { string filter(globlist, i, end-i); if (is_glob(file, filter)) return true; i = end + 1; } } return false; }
string file_read(const string& file) { struct stat st;
const char* path = file_config_file_home(file.c_str());
if (stat(path, &st)!=0) { target_err("Error opening the file '%s'.\n", path); return string(""); }
FILE* f = fopen(path, "rb"); if (!f) { target_err("Error opening the file '%s'.\n", path); return string(""); }
char* ssc = (char*)operator new(st.st_size + 1);
if (fread(ssc, st.st_size, 1, f)!=1) { operator delete(ssc); fclose(f); target_err("Error reading the file '%s'.\n", path); return string(""); }
fclose(f); ssc[st.st_size] = 0;
string ss = ssc; operator delete(ssc);
return ss; }
cammon.h Código: #include "file.h"
#include <string> #include <list>
typedef std::list<std::string> path_container;
inline std::string path_import(const std::string& s) { return file_import(s.c_str()); }
inline std::string path_export(const std::string& s) { return file_export(s.c_str()); }
inline std::string list_import(const std::string& s) { return file_import(s.c_str()); }
inline std::string list_export(const std::string& s) { return file_export(s.c_str()); }
inline const char* cpath_import(const std::string& s) { return file_import(s.c_str()); }
inline const char* cpath_export(const std::string& s) { return file_export(s.c_str()); }
inline const char* clist_import(const std::string& s) { return file_import(s.c_str()); }
inline const char* clist_export(const std::string& s) { return file_export(s.c_str()); }
std::string slash_add(const std::string& s); std::string slash_remove(const std::string& s);
std::string strip_space(const std::string& s); std::string strip_comment(const std::string& s);
std::string file_basename(const std::string& s); std::string file_ext(const std::string& s); std::string file_dir(const std::string& s); std::string file_file(const std::string& s); bool file_crc(const std::string& file, unsigned& crc); std::string file_select_random(const path_container& c);
bool file_exists(const std::string& path);
std::string file_read(const std::string& file);
std::string dir_cat(const std::string& A, const std::string& B); std::string dir_cwd();
std::string path_abs(const std::string& rel, const std::string& cwd); std::string path_rel(const std::string& abs, const std::string& cwd); std::string path_short(const std::string& abs, const std::string& cwd); std::string list_abs(const std::string& rel, const std::string& cwd);
bool file_findinzip_byfile(const std::string& zip_file, const std::string& name, std::string& file, unsigned& crc); bool file_findinzip_byname(const std::string& zip_file, const std::string& name, std::string& file, unsigned& crc);
std::string token_get(const std::string& s, int& ptr, const char* sep); void token_skip(const std::string& s, int& ptr, const char* sep); std::string token_get(const std::string& s, int& ptr, char sep); void token_skip(const std::string& s, int& ptr, char sep);
std::string arg_get(const std::string& s, int& ptr); bool arg_split(const std::string& s, std::string& a0); bool arg_split(const std::string& s, std::string& a0, std::string& a1); bool arg_split(const std::string& s, std::string& a0, std::string& a1, std::string& a2); bool arg_split(const std::string& s, std::string& a0, std::string& a1, std::string& a2, std::string& a3);
bool case_less(const std::string& A, const std::string& B); bool case_equal(const std::string& A, const std::string& B); std::string case_auto(const std::string& A);
std::string subs(const std::string& s, const std::string& from, const std::string& to);
bool is_glob(const char* str_begin, const char* str_end, const char* glob_begin, const char* glob_end); bool is_glob(const std::string& str, const std::string& glob); bool is_globlist(const std::string& file, const std::string& globlist);
#endif
no build menssages da isso Código: ||=== advmenu, Release ===| C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h | | In function `std::string |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |33| error: `file_import' |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |33| error: (Each undeclared |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h | | In function `std::string |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |38| error: `file_export' |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h | | In function `std::string |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |43| error: `file_import' |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h | | In function `std::string |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |48| error: `file_export' |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h | | In function `const char* |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |53| error: `file_import' |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h | | In function `const char* |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |58| error: `file_export' |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h | | In function `const char* |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |63| error: `file_import' |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h | | In function `const char* |
C:\CodeBlocks\MinGW\Advmenu\advance\menu\common.h |68| error: `file_export' |
||=== Build finished: 9 errors, 0 warnings ===|
no build log Código: path_export(const std::string&)':
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h:38: error: `file_export' undeclared (first use this function)
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h: In function `std::string list_import(const std::string&)':
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h:43: error: `file_import' undeclared (first use this function)
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h: In function `std::string list_export(const std::string&)':
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h:48: error: `file_export' undeclared (first use this function)
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h: In function `const char* cpath_import(const std::string&)':
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h:53: error: `file_import' undeclared (first use this function)
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h: In function `const char* cpath_export(const std::string&)':
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h:58: error: `file_export' undeclared (first use this function)
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h: In function `const char* clist_import(const std::string&)':
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h:63: error: `file_import' undeclared (first use this function)
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h: In function `const char* clist_export(const std::string&)':
C:/CodeBlocks/MinGW/Advmenu/advance/menu/common.h:68: error: `file_export' undeclared (first use this function)
Process terminated with status 1 (0 minutes, 1 seconds) 9 errors, 0 warnings
alguem pode minda uma ajuda ai?
|
|
| Topo |
|
 |
|
atmoreira
|
Assunto da Mensagem: Re: nao consigo compilar com codebloks esse codigo fonte Enviado: 12 Mar 2012, 09:47 |
|
Registado: 11 Abr 2008, 16:11 Mensagens: 4 Localização: Brasil
|
|
pelo que vi os arquivos portable.h e fz.h sao da AdvanceMAME entao voce vai ter compilar ela antes pelo erros acho que voce deve ter apenas removido os #include
|
|
| Topo |
|
 |
Quem está ligado: |
Utilizadores a ver este Fórum: Nenhum utilizador registado e 0 visitantes |
|
Criar Tópicos: Proibído Responder Tópicos: Proibído Editar Mensagens: Proibído Apagar Mensagens: Proibído
|
|
 |
|

|
 |