Author Topic: Some #includes work, some dont.. why is that? (No such file... etc.)  (Read 2910 times)

s1234567

  • Guest
Hi everyone, and thanks for tuning in!

Newbie questions asked - newbie answers welcomed  :)

i'm trying to get the codeblock environment up and running but seem to have some trouble when trying to include files. I'm using standard tutorial snippet from various tutorial sources.

First thingy..

A. I can compile/run the standard 'hello world' from the 'console application' wizard.

B. I can compile/run a standard wxsmith/dialog wxwidget wizard generated example.

C. I cannot compile a simple wxwidget 'console application' - 'No such file wx....
-----------
#include <wx/string.h>
#include <wx/utils.h>

int main(int argc, char **argv)
{
  wxPuts(wxGetHomeDir());
  wxPuts(wxGetOsDescription());
  wxPuts(wxGetUserName());
  wxPuts(wxGetFullHostName());

  long mem = wxGetFreeMemory().ToLong();

  wxPrintf(wxT("Memory: %ld\n"), mem);
}
--------------

D. I cannot compile a simple Sqlite3 example where all 3 sqlite c/h files resides in same the same dir.
Errors:
Sqlite files NOT in projectfilelist=no such file etc..
Sqlite files IN project=massive amount of syntax errors with #include <sqlite3.h>.
Sqlite files IN project=undefined reference to.. errors with #include "sqlite3.h".
(strangely explained  :?)

#include <stdio.h>
#include "sqlite3.h"

static int callback(void *NotUsed, int argc, char **argv, char **azColName){
  int i;
  for(i=0; i<argc; i++){
    printf("%s = %s\n", azColName, argv ? argv : "NULL");
  }
  printf("\n");
  return 0;
}

int main(int argc, char **argv){
  sqlite3 *db;
  char *zErrMsg = 0;
  int rc;

  if( argc!=3 ){
    fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
    exit(1);
  }  rc = sqlite3_open(argv[1], &db);
  if( rc ){
    fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
    sqlite3_close(db);
    exit(1);
  }
  rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
  if( rc!=SQLITE_OK ){
    fprintf(stderr, "SQL error: %s\n", zErrMsg);
    sqlite3_free(zErrMsg);
  }
  sqlite3_close(db);
  return 0;
}
-------------------------------

Environment:
wxPack 2.8.7 (wxwidget 2.8.7 (tadae))
Codeblocks 8.02
Sqlite 3.5.7

win vars:
path: c:\dev\codeblocks\mingw\bin;...
WXWIN: C:\Dev\Libraries\wxWidgets2.8
WXADDITIONS. C:\Dev\Libraries\wxWidgets2.8\additions

Global vars: (wx - set with libraryfinder)
base: C:\Dev\Libraries\wxWidgets2.8
Include: C:\Dev\Libraries\wxWidgets2.8\include
Lib. C:\Dev\Libraries\wxWidgets2.8\lib
Obj: C:\Dev\Libraries\wxWidgets2.8\include
cflags: -IC:\Dev\Libraries\wxWidgets2.8\contrib\include -IC:\Dev\Libraries\wxWidgets2.8\lib\gcc_lib\msw -D__GNUWIN32__ -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL
lflags: -LC:\Dev\Libraries\wxWidgets2.8\lib\gcc_lib -lwxmsw28

Question1:
Why can wxsmith include (ex) wx/string.h when i can't ?? It seems that i've missed somthing completely in regards to setting up libraries, but i cant find the required info?  :(

Question2:
Where should i put sqlite3.h, sqlite3.c and sqliteExt.h if i don't want to copy them to every project?

Question3:
The global variable wx - where is it used?

Second thingy..
A different thing. It seems that whenever i paste snippets into my files, codeblocks postulates that my file was changed from outside codeblocks and asks if i want to reload. Is this annoying behaviour intended?

Third thingy..
Is there a utillity out there that takes codeblocks, mingw, libraries, whatever and checks paths/vars/etc, generates testcode, compile and if errors - fix the problem? As it is, it seems like i'm supposed to learn to assemble the engine before i drive the car!? I prefer the other way round  :lol:

Thanks for reading this far..

Simon